CloudTrail Lake SQLHunting query: tune before alertingPrompt injection and exfiltration in LLM app logs
Burst of Bedrock guardrail interventions from one principal and source
Repeated guardrail blocks from the same caller usually mean someone is iterating on jailbreak or prompt-injection attempts, or probing what the filters catch. Bedrock records ApplyGuardrail as a CloudTrail data event (including guardrail evaluations during model invocation) with responseElements.action set to GUARDRAIL_INTERVENED and requestParameters.source set to INPUT or OUTPUT (field names checked against the example ApplyGuardrail data event in the AWS documentation). Data events for the AWS::Bedrock::Guardrail resource type must be enabled.
- Log source
- AWS CloudTrail Lake event data store with Bedrock guardrail data events (AWS::Bedrock::Guardrail)
- Techniques
- LLM01 Prompt Injection · AML.T0054 LLM Jailbreak · AML.T0051 LLM Prompt Injection
- MITRE ATT&CK
- T1699Direct Prompt Injection
- Reviewed
- 2026-11-10
Query · CloudTrail Lake SQL
SELECT userIdentity.arn AS principal, sourceIPAddress,
date_trunc('hour', eventTime) AS hour_bucket,
count(*) AS interventions,
array_agg(DISTINCT element_at(requestParameters, 'source')) AS sources
FROM $EDS_ID
WHERE eventSource = 'bedrock.amazonaws.com'
AND eventName = 'ApplyGuardrail'
AND eventCategory = 'Data'
AND element_at(responseElements, 'action') = 'GUARDRAIL_INTERVENED'
AND eventTime > date_add('day', -7, now())
GROUP BY userIdentity.arn, sourceIPAddress, date_trunc('hour', eventTime)
HAVING count(*) >= 20
ORDER BY interventions DESC Other platforms
Microsoft Sentinel / Defender (KQL)
Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) · Needs Bedrock guardrail data events (AWS::Bedrock::Guardrail) in the trail that feeds the SIEM; management-event-only trails return nothing.
AWSCloudTrail
| where TimeGenerated > ago(7d)
| where EventSource == "bedrock.amazonaws.com" and EventName == "ApplyGuardrail"
| where ManagementEvent == false
| extend Action = tostring(parse_json(ResponseElements).action),
GuardrailSource = tostring(parse_json(RequestParameters).source)
| where Action == "GUARDRAIL_INTERVENED"
| summarize Interventions = count(), Sources = make_set(GuardrailSource)
by UserIdentityArn, SourceIpAddress, HourBucket = bin(TimeGenerated, 1h)
| where Interventions >= 20
| order by Interventions desc Splunk (SPL)
Splunk: AWS CloudTrail (Splunk Add-on for AWS, sourcetype aws:cloudtrail) · Needs Bedrock guardrail data events (AWS::Bedrock::Guardrail) in the trail that feeds the SIEM; management-event-only trails return nothing. Set index= to the index that holds your CloudTrail data.
index=aws sourcetype=aws:cloudtrail eventSource="bedrock.amazonaws.com" eventName="ApplyGuardrail"
eventCategory="Data" responseElements.action="GUARDRAIL_INTERVENED" earliest=-7d
| bin _time span=1h
| stats count AS interventions values(requestParameters.source) AS sources BY _time userIdentity.arn sourceIPAddress
| where interventions >= 20
| sort - interventions Expected false positives
- Applications whose single service role fronts many end users (the principal is the app, not the person; join with app logs)
- Red-team and guardrail evaluation runs
Sources
- AWS docs: Monitor Amazon Bedrock API calls using CloudTrail
- AWS docs: CloudTrail Lake SQL constraints (Trino SQL)
- Elastic rule: Bedrock guardrails multiple violations by a single user
Reviewed against vendor documentation, not tested in your environment. Defensive use only.