A Web Server Log Database
Learn how to build a better web server log using your own mod_perl handler.
Sunday, January 15th, 2006
The server for Stonehenge Consulting (
http://www.stonehenge.com) and a few other sublease customers like Geek Cruises uses
Apache and
mod_perl.
Because the mod_perl processes tend to be heavy, I’ve installed the traditional caching, reverse-proxy server stack so that each mod_perl process can be freed the moment it’s completed its task, and so some lightweight hits (such as images and icons) can be served without touching the backend at all.
For many years, I’ve been logging the backend processes directly to a database with DBI, using a custom mod_perl logger-phase handler. However, because the front processes didn’t have mod_perl, the only logging I could get was a traditional flat file.
Recently, I upgraded to Apache 2.0 and mod_perl2 (which is a bit of a story in itself — perhaps for another time). This required updating my DBI logger a bit. At the same time, I was also asked to track users to the Geek Cruises web site, so I wanted to add mod_usertrack and also add a way to link frontend hits with backend hits for complete correlation.