March 29, 2010
A log file is a lot like a neglected board game covered in dust. I don’t play board games that often, but when I do, I always say “we should do this more often”. The log files we have for Scout collect lots of great information, but we only reference them when investigating an incident. They often aren’t a part of our daily lives (but they should be).
Yaroslav Lazor of Railsware, an agile Ruby on Rails development firm, has created a Scout plugin that makes it easy to extract basic information from a log file on a regular basis. His Log Watcher plugin, brilliant in its simplicity, counts the number of occurrences of a given pattern in a file, reporting the data to Scout.
It’s the perfect plugin for error tracking. Lets says you have a web application that occasionally generates an error and you log those errors to a file. Lets say you proceed the error info with
"[Error]". So, an error might look like this:
[Error] Bats in the belfry
With Yaroslav’s Log Watcher plugin, just provide the following options to calculate the error rate using Scout:
You’ll get a nice graph of the error rate in Scout:
Like with any Scout metric, you can generate an alert based on the value of the error rate using triggers.
It’s easy to change the parsing logic as well. Under the hood, the plugin just uses
grep for counting the number of matches. For example, lets say you’re a glass half-full kind of guy. How about tracking the the number of lines without errors? Easy – we’ll just use the invert-match option with grep (“v”):
Like with any Scout plugin, the Log Watcher plugin is just a button click away (and we’ll give you a 30 day free trial if you are starting out with Scout).
Hats off to Yaroslav and the team at Railsware for making it easy for me to monitor our log files.