7
votes

I have a docker image through which I make an aws batch job definition. Within the docker I am printing some statements. The job runs and there's a success message. But the logs aren't there in Cloudwatch. It says that no events found. Not even the start and endtime of the job.

Cloudwatch logs

I have set up the environment variable ECS_AVAILABLE_LOGGING_DRIVERS = awslogs as well but I still don't see any logs.

What additional configuration are required ?

1
Unlike Lambda, which logs start/end of the job to CloudWatch Logs, Batch will only log output from the container to CloudWatch Logs. Likely your job is simply not logging to STDOUT. You shouldn't have to set any additional configuration to make logs happen - Batch should handle that. - Luke Waite
@LukeWaite OP says that they are printing statements in their docker, this suggests they are either logging to STDOUT or STDERR, both of which should go to CloudWatch. - Aron
What about permissions? Does your docker has permissions to write to CW logs? Is it running on an instance or ECS? - Marcin

1 Answers

1
votes

For Using CloudWatch Logs with container instances you need the following:

  • CloudWatch Logs IAM Policy
  • Installing and configuring the CloudWatch agent on your Container

the steps could be found here