Can we set the days of keeping Cloudwatch logs in the / etc / awslogs / awslogs.conf file
As we know, we can put something like this in a file awslogs.conf
:
[/var/log/mylog]
file = /var/log/mylog.log
log_group_name = mylog
log_stream_name = mystream
datetime_format = %Y-%m-%dT%H:%M:%S.%f
What other parameters can be set in this file? I am looking to set the days of keeping the log - is this possible?
+3
source to share
2 answers
The file awslogs.conf
contains parameters for the agent process , which is responsible for placing your log files in CloudWatch Logs . The management of the basic groups of the journal is outside the scope of its responsibilities.
Assuming the log group is being generated in the user-data
script (comments), you can add an additional command to adjust the retention period:
aws logs put-retention-policy --log-group-name mylog --retention-in-days 7
+4
source to share