Description
CloudTrail can deliver events to CloudWatch Logs alongside its S3 archive.
Potential impact
CloudWatch metric filters and alarms can miss activity if the trail’s events never reach their log group.
Remediation
Set CloudWatchLogsLogGroupArn to the destination log group and CloudWatchLogsRoleArn to a role CloudTrail can assume to write there. Set log retention and confirm events arrive before configuring metric filters and alarms.
Examples
Replace the example ARNs with those of your log group and role.
Before
yaml
Resources:
Trail:
Type: AWS::CloudTrail::Trail
Properties:
S3BucketName: !Ref LogBucket
IsLogging: true
IsMultiRegionTrail: true
After
yaml
Resources:
Trail:
Type: AWS::CloudTrail::Trail
Properties:
S3BucketName: !Ref LogBucket
IsLogging: true
IsMultiRegionTrail: true
CloudWatchLogsLogGroupArn: arn:aws:logs:us-west-2:123456789012:log-group:CloudTrail/DefaultLogGroup:*
CloudWatchLogsRoleArn: arn:aws:iam::123456789012:role/CloudTrailToCloudWatchLogsRole