The log file was bleeding email addresses. Not masked. Not safe. One exposed string could trigger a breach, and CloudTrail logs are no exception.
AWS CloudTrail records every call and event in your AWS environment. This includes parameters, responses, and—too often—raw identifiers like user email addresses. If your logs land in storage without masking sensitive data, you have a compliance problem. Worse, you have a security risk that is searchable, replicable, and permanent.
Masking email addresses in CloudTrail logs should be part of every query runbook you maintain. Start by identifying the fields that contain emails. In CloudTrail, these can appear in userName, principalId, or custom event payloads.
One way to handle masking is to preprocess logs before storage. Use a Lambda function triggered by CloudTrail log delivery into S3. The function scans each record, applies a regex to detect email patterns, and replaces matches with a masked value such as ***@example.com. Keep the format consistent so you can still correlate events without revealing personal data.