3 # Copyright (c) 2002 Ivan Kohler
5 # This program is free software; you can redistribute it and/or modify it under
6 # the same terms as Perl itself.
17 map { ( $_ => $c++ ) } qw( jan feb mar apr may jun jul aug sep oct nov dec );
22 my( $file, $pos ) = @ARGV;
23 open(FILE,"<$file") or die "Can't open $file: $!";
24 seek(FILE,$pos,0) or die "Can't seek: $!";
26 $SIG{'HUP'} = sub { print "EOF\n"; exit; };
27 #$SIG{'HUP'} = sub { $eof=time; }; # set an alarm
33 #rootwood.haze.st - - [24/Dec/2001:15:33:50 -0800] "GET / HTTP/1.0" 200 1388544 "-" "xmms/1.2.5" 89
35 ([\w\-\.]+)\ -\ -\ #hostname
36 \[(\d{2})\/(\w{3})\/(\d{4}):(\d{2}):(\d{2}):(\d{2})\ -(\d{4})\]\ #date
37 "GET\ ([\/\w\-\.]+)\ HTTP\/\d\.\d"\ # request string
38 (\d{3})\ #staus resonse
41 "([^"]*)"\ #user agent
42 (\d+) #seconds connected
44 die "unparsable line: $_";
51 my( $mday, $mon, $year, $hours, $min, $sec, $zone ) =
52 ( $2, $3, $4, $5, $6, $7, $8 );
61 $SIG{HUP} = sub { $eof=1 };
64 hostname => $hostname,
65 start => timelocal($sec, $min, $hours, $mday, $mon{lc($mon)}, $year),
66 mountpoint => $mountpoint,
68 useragent => $useragent,
71 $SIG{'HUP'} = sub { print "EOF\n"; exit; };