from logs-aws_bedrock.invocation-*
// Truncate timestamp to 1-minute window
| eval Esql.time_window_date_trunc = date_trunc(1 minutes, @timestamp)
// Filter for validation exceptions in responses
| where gen_ai.response.error_code == "ValidationException"
// keep relevant ECS and derived fields
| keep
user.id,
gen_ai.request.model.id,
cloud.account.id,
gen_ai.response.error_code,
Esql.time_window_date_trunc
// count number of denials by user/account/time window
| stats
Esql.ml_response_validation_error_count = count(*)
by
Esql.time_window_date_trunc,
user.id,
cloud.account.id
// Filter for excessive errors
| where Esql.ml_response_validation_error_count > 3
Install detection rules in Elastic Security
Detect AWS Bedrock Detected Multiple Validation Exception Errors by a Single User in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).