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

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

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>

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs

Topics:

Published at DZone with permission of Trevor Parsons, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}