roxxypoxxy
roxxypoxxy

Reputation: 3121

ECS Fargate log file location

How can I configure ECS Fargate + Cloudwatch to include specific file location.

I have app-access.log where my framework puts all of my access logs. Cloudwatch currently consumes logs from my server command IO only. How can I tell ECS Fargate to use app-access.log also.

PS. I am using Cloudformation.

Upvotes: 7

Views: 9289

Answers (1)

LiorH
LiorH

Reputation: 18824

ECS or Cloudwatch don't watch files in the container. ECS has integration with the docker logs, if the docker container emits logs from the access.log then these will be available for Cloudwatch. That's why you're only seeing the IO commands.

So it's not about ECS but rather about how docker logging works. See here for more details on docker logging.

You have to make sure any logline is written to STDOUT or STDERR. One method is to symlink /path/to/app-access.log -> /dev/stdout. But usually, it's easier to make sure there's a console appender for your service.

Upvotes: 9

Related Questions