Know Nothing
Know Nothing

Reputation: 1251

Can we set cloudwatch log retention days in /etc/awslogs/awslogs.conf

As we know we can put something like this in awslogs.conf file:

[/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 we set in this file? I am looking to set the log retention days - is it possible?

Upvotes: 12

Views: 8113

Answers (2)

Szymon Jednac
Szymon Jednac

Reputation: 3007

The awslogs.conf file contains settings for the agent process, which is responsible for putting your log files into CloudWatch Logs. Managing the underlying log groups is out of the scope of it's responsibilities.

Assuming that the log group is created in the user-data script (comments), you could add an additional command for setting the retention period there:

aws logs put-retention-policy --log-group-name mylog --retention-in-days 7

Upvotes: 12

Mahdi
Mahdi

Reputation: 3349

For changing log data retention in CloudWatch you can:

  1. go to CloudWatch console
  2. choose Logs in the navigation pane
  3. find your log group
  4. change the value of the Expire Event After column

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

Upvotes: 6

Related Questions