Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 592
roxxypoxxy Avatar asked Nov 07 '18 12:11

roxxypoxxy


1 Answers

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.

like image 164
LiorH Avatar answered Sep 18 '22 02:09

LiorH