in reply to A good way to parse Apache logs

This is just for the historical record, since I'm sure you solved your problem years ago, but I'm having some luck (so far) with HTTPD::Log::Filter. One-line parse-and-extract:

perl -MHTTPD::Log::Filter -lne'BEGIN{$f = HTTPD::Log::Filter->new(form +at=>"ELF",capture=>[qw(authexclude request referer)])} $f->filter($_) +;printf "%s %s\n",$f->authexclude,$f->referer' /var/your_httpd_log_he +re

Granted, I have a longer definition of "one-line" than some, but it still fits in my tcsh buffer...



If God had meant us to fly, he would *never* have given us the railroads.
    --Michael Flanders

Replies are listed 'Best First'.
Re^2: A good way to parse Apache logs (HTTPD::Log::Filter)
by jmccarrell (Novice) on Jun 09, 2008 at 17:48 UTC
    I also had good results with HTTPD::Log::Filter extracting the query strings from my access_log.
    my $hlf = HTTPD::Log::Filter->new(capture => [ qw(request status) ]); ... next unless $hlf->filter($ac_line); next unless $hlf->status == 200; my ($method, $query, $http_version) = split(' ', $hlf->request);