How to rotate logs in AWS CloudWatch?
<p>I am using the Amazon CloudWatch Log Agent (<a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/AgentReference.html" rel="nofollow">AWS documentation</a>) to upload logs from my EC2 instances to the CloudWatch console.</p>

<p>For my CloudWatch Log Agent configuration on EC2, I have the following:</p>

<pre><code>[general]
state_file = /var/awslogs/state/agent-state  

[applog]
file = /var/www/html/logs/applog.log
log_group_name = MyApp
log_stream_name = applog.log
datetime_format = %Y-%m-%d %H:%M:%S
</code></pre>

<p>My question is, how do I get the applog.log to rotate on a daily basis? In the AWS Documentation (link above), it mentions being able to configure log rotation policies, but I can't find any mention/example of how to actually do this. I've tried specifying the log_stream_name as <strong>applog_%Y-%m-%d.log</strong>, but it interprets this literally.</p>

<p>Any ideas or pointers in the right direction would be very welcome - thanks!</p>