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 change how log data is saved to CloudWatch, you can:

  • go to the CloudWatch console.
  • select Logs in the navigation bar
  • find your magazine group
  • change the value of the Expire Event After column


Here you can find a list of other parameters that you can set in the config file.

+2


source







All Articles