Understanding your Logs with Logentries

Written by: Florian Motlik

Here at Codeship we are using lots of different tools to get insight into our users, customers and how they use our product. From Google Docs for some of our Metrics to Mixpanel or New Relic.

A tool we've been using a lot lately is Logentries. In this post I will show you how we use Logentries to have a trace of a build throughout all of our system and how you can use it as well. Just to be open about it, Logentries are a Boston based company who we know very well. We don't just love their product, but especially their team. Obviously we are not purely objective, so take it with a grain of salt. We use their tool every day though, which speaks for itself.

Why we need Logentries

The main reason we started using Logentries was because we wanted to be able to follow anything and any action throughout our system. Especially a build as it flows first into our Rails app, is put onto a queue, gets worked on in our backend servers and then flows back with the result into our Rails app. Even though we use Mixpanel to see the flow of a user on our website, for certain business objects you need to be able to go through the log. Logs are a great way to transport information, but often very verbose. So we need a simple way to search through the log and show the important info to us.

Writing to logs is a very low cost and easy solution to push information out of the app in most frameworks, so perfect for lots of different scenarios. We recreate our backend servers very often, so we needed a service that we can feed the logs into without a lot of hassle and which can be set up automatically. Furthermore I am allergic to running my own infrastructure that isn't tied to our product, so a hosted service was a must.

Setting up Logentries

The Logentries setup is really easy. Especially on our Heroku app it is really just a matter of adding the Addon, everything else is done by them. With our backend server we had a little more hassle, as currently Logentries treats every server as a separate host and not necessarily as part of a larger infrastructure piece. We worked around that for now, but they seem to be working on making this much easier in the future. After the setup you can take a look at their clear interface:

What we use Logentries for

The main use case for us is debugging builds that may have got stuck or any error that is occuring in our infrastructure. Whenever we recognize an error that we can't fix automatically we use Logentries to see exactly what ran, where something may have gotten stuck and what the problem was. Here you can see one build flowing through our system. It is very easy to determine the exact current status and act upon any problems we might see or which get flagged automatically.

We've already fixed a couple of obscure bugs in our system simply because it was so much easier to follow a build throughout the system thanks to Logentries. A great feature that Logentries provides is their Alerts. Look at this simple example: By default all Heroku Error Messages are captured automatically as Alerts from the log and are even sent to you via email. This can be an absolute life saver.

Last but not least: Something I use nearly every day is their Live Feature. Basically it allows you to follow your log live while it is coming in, but more importantly when you search for something it will automatically update the search results when new logs appear. This is perfect for following anything throughout your system.

Conclusions

Logs are a very important and easy to use resource to build a more stable system. Lots of teams aren't using logs efficiently or even at all, so services like

Logentries are an absolute must for everyone to set up. It takes nearly no time but gives you a huge amount of value. Have you already tried Logentries? What are your experiences with it? How do you use it? Let us know in the comments!

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.