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

The Nexus Suite is uniquely architected for a DevOps native world and creates value early in the development pipeline, provides precise contextual controls at every phase, and accelerates DevOps innovation with automation you can trust. Read how in this ebook.

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>

The DevOps Zone is brought to you in partnership with Sonatype Nexus.  See how the Nexus platform infuses precise open source component intelligence into the DevOps pipeline early, everywhere, and at scale. Read how in this ebook

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 }}