Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Simple Logging to Logentries from a Docker Container

DZone's Guide to

Simple Logging to Logentries from a Docker Container

· DevOps Zone ·
Free Resource

Read why times series is the fastest growing database category.

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. Logging with Docker

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>

Learn how to get 20x more performance than Elastic by moving to a Time Series database.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}