Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find gunicorn log file in docker container

I have a docker container running a python service with gunicorn. This is how the service was started :

gunicorn --bind 0.0.0.0:6435 --certfile=cert.pem --keyfile=key.pem --ssl-version=5 --ciphers=EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH app:app -w=5 --timeout=500 --daemon

But, i am unable to find log files for the 5 workers. What would be the default path to find these log files?

I tried using the find command find / -type f -name "hs_err_pid" since these are the default file names gunicorn saves the log files with. But this gives me the following permission errors:

    find: ‘/proc/1/map_files’: Operation not permitted
find: ‘/proc/16/map_files’: Operation not permitted
find: ‘/proc/89/map_files’: Operation not permitted

Any way to find out the log files?

like image 391
Dreams Avatar asked Nov 07 '19 11:11

Dreams


People also ask

Where are gunicorn log files?

This log file is located at /var/log/cloudify/rest/gunicorn-access.

Where are logs stored in a docker container?

By default, the Docker containers log files are stored in /var/lib/docker/containers/<containerId> dir.

How do I view a docker log file?

You find these JSON log files in the /var/lib/docker/containers/ directory on a Linux Docker host.

Can I access the logs of the docker container?

The docker logs command shows information logged by a running container. The docker service logs command shows information logged by all containers participating in a service. The information that is logged and the format of the log depends almost entirely on the container's endpoint command.


1 Answers

I suggest you to add --access-logfile YOUR_FILE to your command to specify a file or redirect it to stdout using -. the same goes for error logs.

see this

like image 155
LinPy Avatar answered Oct 17 '22 06:10

LinPy