loggrok - a simple log parsing library (with pretty code)

by Jeremy Jones

I noticed a link to loggrok (which is a simple log parsing library/framework) the other day on the CheeseShop updates page. I brought the link up in Firefox and decided to look at it later. Later happened this morning since I was at Walt Disney World the better part of last week.

The install for loggrok was as simple as `easy_install loggrok`. The only snag I ran into was that I needed to install the libxml2-dev and libxslt1-dev packages (under Ubuntu Edgy) for a dependency on lxml.

After I installed it, I was able to run the example program on a logfile containing the following lines:


2007-02-05 08:55:33,123 WARN THIS IS A WARNING
2007-02-05 08:55:33,123 ERROR THIS IS AN ERROR
2007-02-05 08:55:33,123 WARN THIS IS A WARNING


This seems like a nice little log parsing library. But the more interesting part of the library is that the code is quite pretty. Both the loggrok and the supporting xix library (both written by Drew Smathers) are well documented (by way of docstrings) and very clean to look through. If you don't have use for a log parsing library/framework, I'd still recommend downloading loggrok just to look through the code to give you ideas for how to document and lay out your code. This openness which often leads to fruitful cross-pollination is one of the many reasons I love open source. Thanks, Drew!