Monthly Archive for March, 2009

filtlog: Simple page hit/referrer summaries

I’ve tried a few different log file analyzers for getting stats about my web site, but they’ve all been confusing or lacking some features. FireStats is nice, but it only handles part of my site (the blog part) and I have no idea what time period it’s using in its page counts. The Webalizer is also useful, but it doesn’t understand that “/?p=266” is a different URL from “/?p=80” and its filtering options are non-obvious.

So I decided to write my own, filtlog, which you can find at:

http://github.com/ossguy/filtlog

It is very simple and easy to use. Just pass your web server log file or a set of log files to it and it will print a summary of how many hits each page got and which referrers were the most popular for each page. To make your results more accurate, you can add user agent strings of known bots to the config file, which causes those bots to be ignored in the results. You can also make the results more concise by specifying a maximum number of pages you want results for.

Because the code is very simple (50 lines of Ruby), filtlog is an excellent starting point for building more complex analysis tools. It is easy to change filtlog to organize the stats differently or provide other features like user agent tallying.

If you have any questions about filtlog, including how to use it or how the code works, post a comment on this article.