Last updated at Fri, 03 Nov 2017 21:38:38 GMT
Guest blog post on quick tips for logging from a Docker container by Logentries customer Gal Ben-Haim, Head of Software at Augury, @gbenhaim
While building Docker images for a production deployment I encountered a problem with proper logging of what’s going on inside the containers, especially if using supervisord to run multiple processes.
One simple solution can be to share the /var/log/supervisor directory with the host.
Since I’m already using Logentries for centralized logging solution and I’ve already written a Golang client lib for it, I decided to use it for a simple log dump solution that can be used from inside a Docker container — https://github.com/bsphere/lecat
All there is left to do is create a new Logentries token and change the stdout change the random log file names of supervisord child processes to known path as described in http://supervisord.org/configuration.html.
Then, add additional supervisord child processes such as:
[program:log_nginx] command=tail -F /var/log/nginx/access.log | lecat -token <logentries_token>