Posted On: Feb 25, 2022
Amazon CloudWatch agent now allows you to specify how long CloudWatch will retain log events. You can install and configure CloudWatch agent to collect system and application logs from Amazon Elastic Compute Cloud (EC2), on-premises hosts, and containerized applications and send them to CloudWatch. This new configuration option is intended for users who want to apply uniform log group retention periods when deploying the agent.
Using CloudWatch agent, you can now specify the retention period of log events inside the agent configuration file. By default, logs are kept indefinitely and never expire. You can adjust the retention policy for each log group, keeping the indefinite retention, or choosing a retention period between 10 years and one day. This enables you to apply log group retention periods without accessing the CloudWatch console, simplifying log group configuration when automating agent deployments. Retention periods can now be set by the agent on newly created log groups when Auto Scaling hosts.
Amazon CloudWatch Agent is available in all commercial AWS regions, and AWS GovCloud (US).
To get started, see Create or Edit the CloudWatch Agent Configuration File in the Amazon CloudWatch User Guide. To learn more about Log Group Retention Periods, see Working with Log Groups and Log Streams in the Amazon CloudWatch Logs User Guide.