Monday, 20 January 2020

AWS CloudWatch - awslogs.log:Error Caught exception: An error occurred PutLogEvents operation

After Cloudwatch agent installation in the install when you check the agent log /var/log/awslogs.log

Error:
"cwlogs.push.publisher - WARNING - 18071 - Thread-3 - Caught exception: An error occurred (ResourceNotFoundException) when calling the PutLogEvents operation: The specified log group does not exist"


Solution:

Make sure in the IAM role policy you have PutLogEvents permission or create new policy with
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogStreams" ], "Resource": [ "arn:aws:logs:*:*:*" ] } ] }
and attach to EC2 instance then restart the clouldwatch

Then stop and start the services.
systemctl stop awslogsd
systemctl start awslogsd
then check the log

No comments: