Troubleshoot Missing Amazon Bedrock Model Invocation Logs and Monitor Guardrails Quotas
7 common causes of missing Bedrock invocation logs, with verification queries and Guardrails quota monitoring patterns.
TL;DR
If your Bedrock model invocation logs stopped appearing, check these 7 common causes (Section 2). The #1 reason: the Responses API (Mantle endpoint) does not produce invocation logs — this catches most customers using OpenAI-compatible endpoints. If you're hitting
ApplyGuardrail throttling, use the chunking pattern in Section 4.
Overview
Amazon Bedrock model invocation logging enables you to collect metadata, request data, and response data for all model invocations in your AWS account. This article covers how to enable logging correctly, troubleshoot missing logs, verify that logging is operational, monitor Guardrails quotas to prevent throttling, and reduce inference latency.
1. How to Enable Bedrock Model Invocation Logging
Model invocation logging captures calls made through the
bedrock-runtime endpoint for these operations:-
Converse/ConverseStream
-
InvokeModel/InvokeModelWithResponseStream
Important: Calls made through other endpoints (such as the Responses API on thebedrock-mantleendpoint) are not captured by invocation logging.
Choosing a Logging Destination
Destination | Best For | Limitations |
|---|---|---|
CloudWatch Logs only | Real-time monitoring, CloudWatch Insights queries, alarms, dashboards | Input/output >100 KB requires S3 for large data delivery |
Amazon S3 only | Long-term storage, cross-Region replication, Athena queries, ETL with Glue | No real-time querying |
Both | Full coverage — real-time + archival | Most configuration overhead |
Step-by-Step: CloudWatch Logs Destination
- Create a CloudWatch Log Group
- Navigate to CloudWatch → Log Groups → Create log group
- Recommended name:
/aws/bedrock/model-invocations
- Set retention to match your organization's compliance requirements
- Create an IAM Role with the following trust policy and permissions: Trust Policy:````json
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "bedrock.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "YOUR_ACCOUNT_ID" }, "ArnLike": { "aws:SourceArn": "arn:aws:bedrock:YOUR_REGION:YOUR_ACCOUNT_ID:*" } } } ]}
Role policy:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": "arn:aws:logs:YOUR_REGION:YOUR_ACCOUNT_ID:log-group:YOUR_LOG_GROUP:log-stream:aws/bedrock/modelinvocations" } ] }3. Enable Logging in the Bedrock Console
Bedrock Console → Settings → Enable Model invocation logging
Select modalities: Text, Image, Embedding, Video (data logs for all models supporting those modalities)
Choose CloudWatch Logs only and enter your log group name
Select Create and use a new role or attach the role created above
Step-by-Step: S3 Destination
- Create an S3 Bucket (must be same account and Region)
- Recommended naming:
bedrock-logging-ACCOUNTID-REGION
- Ensure bucket ACLs are disabled (Object Ownership set to BucketOwnerEnforced)
- Attach Bucket Policy:````json
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AmazonBedrockLogsWrite", "Effect": "Allow", "Principal": { "Service": "bedrock.amazonaws.com" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::YOUR_BUCKET/AWSLogs/YOUR_ACCOUNT_ID/BedrockModelInvocationLogs/*", "Condition": { "StringEquals": { "aws:SourceAccount": "YOUR_ACCOUNT_ID" }, "ArnLike": { "aws:SourceArn": "arn:aws:bedrock:YOUR_REGION:YOUR_ACCOUNT_ID:*" } } } ]}- Enable logging in the Bedrock console and point to this bucket.
Programmatic Configuration (API)
Use these APIs for infrastructure-as-code:
-
PutModelInvocationLoggingConfiguration— enable/update logging
-
GetModelInvocationLoggingConfiguration— verify current config
-
DeleteModelInvocationLoggingConfiguration— disable logging
2. Common Pitfalls — Why Logs Stop Appearing
If you've enabled logging but see no log events (or logs stop arriving), check these common causes:
a) IAM Role Trust Policy Missing Conditions
The IAM role trust policy must include both
aws:SourceAccount and aws:SourceArn conditions. Without these, Bedrock cannot assume the role.Fix: Verify the trust policy includes the exact account ID and region ARN condition.
b) Log Group Resource ARN Mismatch
The role policy must reference the exact log stream path:
log-group:YOUR_LOG_GROUP:log-stream:aws/bedrock/modelinvocations Fix: Ensure the log group name in the policy matches what's configured in Bedrock Settings. Check for typos and trailing slashes.
c) Region Mismatch
The S3 bucket, CloudWatch log group, and Bedrock configuration must all be in the same Region.
Fix: Verify all resources are in the same Region. Cross-Region logging is not supported.
d) Log Group Retention Policy Deleting Logs
If your log group has a short retention (e.g., 1 day), older logs disappear.
Fix: Set retention to at least 30 days for operational use, or configure S3 export for long-term archival.
e) S3 Bucket ACLs Enabled
If bucket ACLs are enabled, the bucket policy may not take effect and Bedrock silently fails to write.
Fix: Disable ACLs (set Object Ownership to "Bucket owner enforced").
f) Endpoint Mismatch (Mantle/Responses API)
Invocation logging only captures calls through the
bedrock-runtime endpoint. If your application uses the Responses API via the bedrock-mantle endpoint, those calls will not appear in invocation logs.Fix: Verify which API endpoint your application calls. If using the Responses API, note that logging for this endpoint is not currently supported.
g) SSE-KMS Key Policy Missing
If your S3 bucket uses KMS encryption, the KMS key policy must grant
kms:GenerateDataKey to bedrock.amazonaws.com .Fix: Add the Bedrock service principal to your KMS key policy.
3. Verifying Logging is Working
Quick CloudWatch Logs Insights Query
Run this query in CloudWatch Logs Insights against your Bedrock log group to confirm logs are flowing:
fields @timestamp, modelId, operation, input.inputTokenCount, output.outputTokenCount| sort @timestamp desc| limit 20Validate Log Delivery Latency
fields @timestamp, @ingestionTime| stats avg(@ingestionTime - @timestamp) as avg_delivery_lag_ms| limit 1If this returns no results, logs are not being delivered. Re-check the IAM role and log group configuration.
Count Invocations by Model
fields modelId| stats count(*) as invocations by modelId| sort invocations descDetect Missing Models
If you expect logs from a particular model but see none, verify:
- The model supports the modality you selected (Text/Image/Embedding/Video)
- The invocations are hitting the
bedrock-runtimeendpoint
- There are no SCPs or IAM policies blocking the logging role
4. Monitoring Bedrock Guardrails Quotas
The
ApplyGuardrail API has a default limit of 25 text units per second (approximately 25,000 characters/second). Exceeding this results in ThrottlingException .Setting Up Proactive Monitoring
CloudWatch Metrics to Monitor:
-
Invocations— total Bedrock API calls
-
InputTokenCount— tracks consumption toward TPM quotas
Create a CloudWatch Alarm:
MetricName: InvocationsNamespace: AWS/BedrockStatistic: SumPeriod: 60Threshold: 80% of your RPM quotaComparisonOperator: GreaterThanThresholdHandling Guardrails Throttling
When your input exceeds the 25 text unit limit, implement chunking:
TEXT_UNIT = 1000 # charactersLIMIT_TEXT_UNITS = 25MAX_CHUNK_SIZE = 12 # text units per chunk
def apply_guardrail_safely(text, guardrail_id, guardrail_version="DRAFT"): if len(text) <= LIMIT_TEXT_UNITS * TEXT_UNIT: # Single request — within limits return apply_guardrail(text, "INPUT", guardrail_id, guardrail_version) else: # Chunk to avoid throttling results = [] for i in range(0, len(text), MAX_CHUNK_SIZE * TEXT_UNIT): chunk = text[i:i + MAX_CHUNK_SIZE * TEXT_UNIT] result = apply_guardrail(chunk, "INPUT", guardrail_id, guardrail_version) results.append(result) return resultsRequesting a Quota Increase
If your workload consistently needs higher throughput:
- Open the Service Quotas console
- Search for "Bedrock" → find
ApplyGuardrailquotas
- Request an increase with:
- Model ID and Region
- Use case description
- Projected steady-state and peak usage
Note: In cross-account guardrail enforcement scenarios, consumption is calculated per guardrail ARN per request, counted toward the account making the API call.
5. Latency Troubleshooting
Common Causes of High Latency
Cause | Diagnosis | Solution |
|---|---|---|
Distance to endpoint | High TTFB (Time to First Token) | Select a closer Region or use cross-Region inference |
Large/complex prompts | High input token count | Reduce prompt size, use structured templates |
Model size | Consistent high latency across all requests | Use smaller model variant (e.g., Haiku vs Opus) |
Simultaneous API calls | Throttling errors before latency spikes | Implement exponential backoff with jitter |
Non-streaming API | Waiting for full response generation | Switch to ConverseStream or InvokeModelWithResponseStream |
Diagnosing Latency with OTPS (Output Tokens Per Second)
InvocationLatency alone can't distinguish between the model being slow vs generating more tokens. Use Output Tokens Per Second (OTPS) to isolate service-side throughput:OTPS = OutputTokenCount / (InvocationLatency - TimeToFirstToken)Note: OTPS requires theTimeToFirstTokenmetric, which is only published for streaming operations (ConverseStream,InvokeModelWithResponseStream).
Use Latency-Optimized Inference
For supported models, set the
performanceConfig parameter:{ "performanceConfig": { "latency": "optimized" }}Supported models (via cross-Region inference):
- Amazon Nova Pro
- Anthropic Claude 3.5 Haiku
- Meta Llama 3.1 70B and 405B
Available in US East (Ohio) and US West (Oregon) regions.
Implement Retries with Exponential Backoff
from botocore.config import Config
config = Config( retries={ 'max_attempts': 10, 'mode': 'adaptive' # Automatically adjusts retry behavior })bedrock_runtime = boto3.client('bedrock-runtime', config=config)Key retry best practices:
- Ensure backoff reaches at least 60 seconds to align with per-minute quota refresh cycles
- Add random jitter to prevent thundering herd
- Distribute requests across multiple seconds within each minute
Use Cross-Region Inference Profiles
Distribute traffic across multiple Regions for better availability:
- Each Region maintains independent capacity pools
- Traffic is dynamically routed for optimal availability
- Helps during high-usage periods or regional capacity constraints
Summary of Best Practices
Area | Best Practice |
|---|---|
Logging setup | Use both S3 + CloudWatch Logs; S3 for archival/Athena, CloudWatch for real-time alerts |
IAM security | Always include aws:SourceAccount and aws:SourceArn conditions in trust policies |
Verification | Run CloudWatch Insights queries weekly to confirm log flow |
Guardrails quotas | Chunk inputs >25,000 characters; monitor Invocations metric; request increases proactively |
Latency | Use streaming APIs, latency-optimized inference, cross-Region profiles; monitor OTPS not just InvocationLatency |
Resilience | Implement adaptive retry with exponential backoff and jitter |
Related Resources
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article