http://qs321.pair.com?node_id=215744


in reply to Parsing Apache Log to Get Most Recent File Access

Why not Apache::ParseLog?

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)

  • Comment on Re: Parsing Apache Log to Get Most Recent File Access

Replies are listed 'Best First'.
Re: Re: Parsing Apache Log to Get Most Recent File Access
by enoch (Chaplain) on Nov 25, 2002 at 23:02 UTC
    I installed Apache::ParseLog and started playing around with it. Here is my quick mock-up code with it:
    #!/usr/bin/perl use warnings; use strict; use Apache::ParseLog; my $parseObj = new Apache::ParseLog(); $parseObj = $parseObj->config(transferlog => '/usr/local/apache/logs/access_lo +g'); my $transferLog = $parseObj->getTransferLog(); my %hosts = $transferLog->host(); foreach my $key (keys %hosts) { print "$key => $hosts{$key}\n"; }
    The problem is that none of the hashes you can access via it's methods contain all three items I am looking for -- IP, filename, and date. Here are all the methods that return information about the logs. None of them return a hash having all the info I want. The two closest methods are host() which returns a hash keyed in by IP's with the value being the total times that that IP has come to the site. And, then there's hitbydatetime() which returns a hash keyed in by datetime stamps with the value being the number of hits at that time. But, I can't cross-reference one with the other.

    enoch