Anyway, I manage a farm of servers for a government contractor (and no, we don't use cookies to track your life). Frequently I am asked to parse and compile large volumes of logs to extract various bizarre information. I have for many years just parsed the standard output from Apache. However, today, out of boredom, I decided to make that easy task simpler.
I wrote the following LogFormat for Apache that works quite well. It allows you to read in a line of the log and assign it directly to a hash. Like this:
The LogFormat is like this:while (<LOGFILE>) { my %hash=eval $_; ## do something with %hash }
Not terribly exciting, or unique or difficult; but helpful.LogFormat "(bytes=>'%b',filename=>'%f',remotehost=>'%h',remoteip=>'%a' +,remoteuser=>'%l',serverport=>'%p',pid=>'%P',request=>'%r',status=>'% +s',time=>'%t',timeserve=>'%T',authuser=>'%u',url=>'%U',virtual=>'%v') +" log_perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl readable Weblogs
by knobunc (Pilgrim) on Apr 18, 2001 at 23:18 UTC | |
by tadman (Prior) on Apr 19, 2001 at 01:22 UTC | |
by mr.nick (Chaplain) on Apr 19, 2001 at 21:24 UTC | |
by knobunc (Pilgrim) on Apr 20, 2001 at 00:18 UTC | |
|
Re: Perl readable Weblogs
by zigster (Hermit) on Apr 18, 2001 at 17:49 UTC | |
by mr.nick (Chaplain) on Apr 18, 2001 at 17:51 UTC | |
by zigster (Hermit) on Apr 18, 2001 at 17:55 UTC |