x
Loading
 Loading
Hello, Guest | Login | Register

A Web Server Log Database

Learn how to build a better web server log using your own mod_perl handler.

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.
At first, I just enabled the DBI logger in the front servers, but within a few days, things started breaking. Because I use PostgreSQL, each child process in both the front (many) and back (few) servers was maintaining a separate connection to the database, causing both out of memory and out of connections errors. Even worse, if the number of connections was just teetering…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. InnoDB Performance Monitoring with innotop
  2. MySQL Upgrade Testing
  3. Some Reasonable Defaults for MySQL Settings
  4. Hacking with CouchDB
  5. An Introduction to CouchDB
Follow Linux Magazine
Rackspace