0
votes

I was trying to change AWS CloudWatch Log Group and Stream Name as follow:

cat <<EOT >> /etc/awslogs/awscli.conf
[/var/log/messages]
file = /var/log/messages
log_group_name = MY_LOG
region = ap-southeast-1
log_stream_name = {instance_id}
datetime_format = %b %d %H:%M:%S
EOT

And I've tried to stop and start CloudWatch agent, log group name and stream name could not be changed as expected. Please help me how to do it.

1

1 Answers

1
votes

It should be /etc/awslogs/awslogs.conf and not /etc/awslogs/awscli.conf.

The rest of your configuration file looks fine.

You can also check your /var/log/awslogs.log for eventual error messages linked to IAM permissions.

See also Why can’t I push log data to CloudWatch Logs with the awslogs agent?.