myomancer has asked for the wisdom of the Perl Monks concerning the following question:

I downloaded and installed the Apache::ParseLog module. Then I grabbed the script "Example 1: Basic Report" from http://theoryx5.uwinnipeg.ca/CPAN/data/Apache-ParseLog/ParseLog.html.

Then I changed $conf to point to the right place on my system.

When I run the script I get this error:

<CODE FONT=+1> TransferLog Report Apache::ParseLog::getTransferLog: does not exist. Exiting at log.pl line 11</CODE>

I've tried it on SCO and Linux; same result on both.

If I edit ParseLog.pm and hardcode $logfile as "/usr/local/lib/apache/logs/access_log", it works fine.

Can anybody offer an explanation and/or solution?

Thanks

Replies are listed 'Best First'.
Re: Apache::ParseLog
by davemabe (Monk) on May 01, 2001 at 17:44 UTC
    I went through this drill a while back. I found that the best solution was installing a custom apache log handler that sends logs to a database. It works great. Here is an example script to do it. It was easy enough to look at this script and then write my own. I don't fool with parsing that silly access log anymore. What a pain.

    Dave
      And you use this in production? Ouch.

      I have some code that isn't all that complex. It takes an access log and parses it and drops it into a heavily normalized database. From there you can run all sorts of queries against it.

      The hardest part is parsing the access log string; I haven't seen any good perl code ever (even the stuff I wrote :)) that does a perfect job. You're always going to miss some records -- especially because people do things like 'get /"' for some weird reason and throw off the quoting context.

      One option I haven't played with yet is using a funky delimiter between every entry, like |&| or something that should never occur in nature. This breaks a bunch of propietary software we use, so it isn't really an option here.

      My experience with Apache::ParseLog is that it does far too much. You should be able to feed it a format string and a filehandle -- how often do you parse your logs while they are sitting on a web server?

      out.