CloudWatch stopping tail when file is deleted

0

I am trying to monitor a log file on an EC2 instance that is deleted and re-added every morning. I have CloudWatch agent monitoring the path but as soon as the file is deleted, the tail stops and when the file is added again with the same name, the log is not pushed to CloudWatch.

When I restart the agent and check the status I get this:

May 07 08:31:29 <servername> start-amazon-cloudwatch-agent /[ 31209 /] : 2020/05/07 08:31:29 Stopping tail as file no longer exists: <filepath/file.json>

Any thoughts?

Edited by: niamh on May 7, 2020 2:36 AM

Edited by: niamh on May 7, 2020 2:36 AM

niamh
질문됨 4년 전768회 조회
1개 답변
1

the cloudwatch agent checkpoints via file handles, not the name of the file.

You should use something like logrotate to rotate the file, not just delete it. By doing so, Cloudwatch will be able to continuously monitor the file.

답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠