Centralized logging
AWS log archiving architecture with EventBridge, Lambda, Kinesis, and S3 components.

-
A CloudWatch log group update workflow runs during the Logging stage of the pipeline. A CloudFormation custom resource invokes a Lambda function that updates existing log groups to the increase log retention if it’s less than the solution log retention period, CloudWatch AWS KMS key, and subscription filter. The destination for the subscription filter is an Amazon Kinesis Data Stream deployed to the Log Archive account. For example, before solution is installed if there are existing log groups
LogGroupA
with 5 years retention andLogGroupB
with 1 week retention. The solution is deployed with 1 year retention in global-config.yaml undercloudwatchLogRetentionInDays
. ThenLogGroupA
will be unaffected with the update since 5 years is greater than 1 year butLogGroupB
retention will change to 1 year. If in a subsequent update or initial update, solution is deployed with 10 years retention in global-config.yaml undercloudwatchLogRetentionInDays
, then both log groups will change retention to 10 years. -
An EventBridge rule monitors for new CloudWatch log groups created in core and workload accounts.
-
When new log groups are created, the EventBridge rule invokes a Lambda function that updates the log group with the configured log retention period, CloudWatch AWS KMS key, and subscription filter. The destination for the subscription filter is the Kinesis Data Stream deployed to the Log Archive account. Since log replication to s3 is active, any CreateLogGroup API call will get the retention specified in global-config.yaml under
cloudwatchLogRetentionInDays
. So ifcloudwatchLogRetentionInDays
is set to 1 week and new log group is created with 5 year retention then it will change to 1 week. The solution ensures that entire organization’s CloudWatch retention for any new log group is compliant under the value specified in global-config.yaml undercloudwatchLogRetentionInDays
. -
Log groups stream their logs to the Kinesis Data Stream. The data stream is encrypted at rest with the replication AWS KMS key.
-
A delivery stream is configured with the Kinesis Data Stream and Firehose, allowing the logs to be transformed and replicated to Amazon S3.
-
The destination of the Firehose delivery stream is the
aws-accelerator-central-logs
Amazon S3 bucket. This bucket is encrypted at rest with the central logging AWS KMS key. In addition, theaws-accelerator-s3-access-logs
andaws-accelerator-elb-access-logs
buckets are encrypted at rest with Amazon S3-managed server-side encryption (SSE-S3) because these services don’t support customer-managed AWS KMS keys. Logs delivered to theaws-accelerator-elb-access-logs
bucket replicate to the central logs bucket with Amazon S3 replication.