Skill 2.3.5
Protect sensitive content in monitoring logs during interactions with AI services.
Key Concepts
Amazon Bedrock model invocation logging is turned off by default. When it is enabled for an account and Region, Bedrock records the request and response data, such as text and images, with metadata, to a CloudWatch Logs log group, an S3 bucket or both. This is valuable for auditing and debugging, but it copies every prompt into the log destination, so the developer chooses which data types to log and protects the destination. AWS CloudTrail records who called which model and when, but not the prompt or response text.
The log destination is protected in layers. The log group or bucket is encrypted with a customer managed KMS key whose key policy limits who can decrypt; IAM limits who can read the logs; a retention period deletes them when no longer needed; and S3 Block Public Access stays on. A CloudWatch Logs data protection policy detects data identifiers such as email addresses and credit card numbers in the log group and masks them, so only principals with logs:Unmask can see the original values; it can also send findings to an audit destination.
Application logs need the same discipline. Code logs request IDs, model IDs, token counts and latency, but not complete prompts by default; when content must be logged, it is masked first, for example with the Powertools for AWS Lambda data masking utility or the output of a guardrail's sensitive information filter. Traces of agent runs in AgentCore Observability can include prompts and tool inputs, so their log groups receive the same encryption, access and data protection policies.
Developer tools are included as well. When an administrator enables prompt logging for Kiro enterprise users, the logs are written to an S3 bucket in the customer's account, which can use a customer managed KMS key, and secrets are kept out of prompts with .kiroignore.