There's another option which makes pulling that kind of data on-the-fly much easier. Check out the
Apache::DBILogger module. It allows you to configure Apache to log all of the access data to MySql (or technically, any DBI-comaptible database). I use it and it works exceptionally. I find it much easier to generate statistical data from site activity when I can just crank out a Perl script to read data from MySql rather than parse a text log file.
One caveat, however, is that it does require that your Apache be built with Mod_Perl.