docker-nginx-amplify icon indicating copy to clipboard operation
docker-nginx-amplify copied to clipboard

Is it possible to log to docker logs?

Open timwis opened this issue 4 years ago • 1 comments

Hello, I'm running this container in production, but it's a bit tricky to view its logs to troubleshoot an issue.

I use a platform-as-a-service (Digital Ocean App Platform, which is similar to Heroku), which streams the results of docker logs to a web interface. Unfortunately this doesn't show anything with this container, like it does for the official nginx image. Similarly, if I were to SSH into my server and run docker logs I wouldn't see the logs. I'd have to attach to the container and tail the access.log and error.log.

The official nginx image creates a symbolic link from /var/log/nginx/access.log to /dev/stdout, and creates another symbolic link from /var/log/nginx/error.log to /dev/stderr, which allows docker to output its logs without nginx knowing. This amplify image undoes this, assumedly so the python agent can access the log files asynchronously.

This sounds like an issue most users of this docker image have faced. Any suggestions for how to stream the logs to docker logs?

timwis avatar Mar 26 '21 07:03 timwis

The docs talk about using syslog, however it does not seem to be straightforward to configure this in a docker environment. If someone has more specific instructions on how to do this, much appreciated 😄

sdurandeu avatar Apr 02 '21 09:04 sdurandeu