12

正如我们所知,我们可以将这样的内容放入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

我们可以在这个文件中设置哪些其他参数?我正在寻找设置日志保留天数 - 可以吗?

4

2 回答 2

12

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
于 2017-08-01T00:12:40.437 回答
7

要更改 CloudWatch 中的日志数据保留,您可以:

  1. 转到 CloudWatch 控制台
  2. 在导航窗格中选择日志
  3. 找到你的日志组
  4. 更改Expire Event After列的值

在这里您可以找到可以在配置文件中设置的其他参数的列表。

于 2017-07-20T13:37:16.147 回答