Techniques
Sample rules
GCP Vertex AI Response Blocked by Safety Filters
- source: elastic
- technicques:
Description
Detects Vertex AI GenerateContent responses whose candidate finish_reason is SAFETY. That value is emitted when Gemini safety filters stop generation. Unlike textual refusals (finish_reason STOP), SAFETY means the provider blocked or truncated the completion.
Detection logic
from logs-gcp_vertexai.prompt_response_logs-* metadata _id, _version, _index
| where
data_stream.dataset == "gcp_vertexai.prompt_response_logs" and
MV_CONTAINS(gcp.vertexai.prompt_response_logs.full_response.candidates.finish_reason, "SAFETY")
| keep
_id,
_version,
_index,
@timestamp,
cloud.project.id,
gcp.vertexai.prompt_response_logs.model,
gcp.vertexai.prompt_response_logs.api_method,
gcp.vertexai.prompt_response_logs.full_request.contents.parts.text,
gcp.vertexai.prompt_response_logs.full_request.safety_settings.category,
gcp.vertexai.prompt_response_logs.full_request.safety_settings.threshold,
gcp.vertexai.prompt_response_logs.full_response.candidates.finish_reason,
gcp.vertexai.prompt_response_logs.full_response.candidates.safety_ratings.category,
gcp.vertexai.prompt_response_logs.full_response.candidates.safety_ratings.probability,
gcp.vertexai.prompt_response_logs.full_response.candidates.safety_ratings.severity