Making The Insights For Log Data Simply Accessible

Trevor Parsons

Subscribe to Trevor Parsons: eMailAlertsEmail Alerts
Get Trevor Parsons: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: DevOps Journal

Blog Post

Docker Logentries Container | @DevOpsSummit #DevOps #Docker #Containers #Microservices

The Docker Logentries Container pulls statistics from the Docker Remote API

How to Log with the Docker Logentries Container

By Mike Neville-O'Neill

Logentries offers a variety of ways to get logs out of your containerized environment, including our Linux Agent, application plugin libraries, and Syslog. In this post we'll cover collecting and forwarding logs via our Docker Logentries Container, which requires Docker 1.5 or higher.

To configure the Docker Logentries Container you'll need to do the following:

  • Create a destination log in your Logentries account to record your Docker logs.
  • Clone the Docker Logentries repository to your container host(s) and build the logging container.
  • Run the Docker Logentries Container.

loggin-from-the-docker-logentries-container

First, you'll need to sign-up for a free Logentries trial if you don't already have an account.

Next, create a token-based log using the instructions available in our documentation. Copy the log token associated with your newly created log and keep it somewhere handy; you'll need it to configure the Docker Logentries Container.

Now you'll need to clone the Docker Logentries repository to your server or instance and build the logging container by running the following as separate commands in your terminal:

git clone https://github.com/nearform/docker-logentries.git
cd docker-logentries
sudo docker build -t docker-logentries .

Lastly, run the container in the background using the log token you obtained earlier:

sudo docker run -d -v /var/run/docker.sock:/var/run/docker.sock logentries/docker-logentries -t <YOUR_LOG_TOKEN> -j

You can pass the -j switch if you log in JSON format, like Bunyan. You can also pass the--no-stats flag if you do not want container statistics to be forwarded to Logentries. The -a or --add flag allows adding fixed values to log messages before they are sent to Logentries. These values are added to your log messages in an easily searchable key value pair format, i.e. "name=value".

That's it! Once you run the Docker Logentries Container it will immediately begin collecting logs from existing containers, and will automatically collect logs from new containers as soon as they're created.

The Docker Logentries Container pulls statistics from the Docker Remote API, and provides metrics relating to network, memory, and CPU utilization. The logging container will also forward all other logs sent to STDOUT from your containers.

By installing the Docker Community Pack in your Logentries account, you can quickly set up dashboards, tags, alerts and saved queries to ensure you're getting the most out of your container metrics.


10-ways-to-lead-with-analytics

Sign-up for a free 30 Day Trial

Get set up in minutes, and gain insights in seconds

Start Free Trial Setup a Demo

More Stories By Trevor Parsons

Trevor Parsons is Chief Scientist and Co-founder of Logentries. Trevor has over 10 years experience in enterprise software and, in particular, has specialized in developing enterprise monitoring and performance tools for distributed systems. He is also a research fellow at the Performance Engineering Lab Research Group and was formerly a Scientist at the IBM Center for Advanced Studies. Trevor holds a PhD from University College Dublin, Ireland.