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
38 \[(\d{2})\/(\w{3})\/(\d{4}):(\d{2}):(\d{2}):(\d{2})\ -(\d{4})\]\ #date
39 "GET\ ([\/\w\-\.]+)\ HTTP\/\d\.\d"\ # request string
40 (\d{3})\ #staus resonse
43 "([^"]*)"\ #user agent
44 (\d+) #seconds connected
46 die "unparsable line: $_";
53 my( $mday, $mon, $year, $hours, $min, $sec, $zone ) =
54 ( $4, $5, $6, $7, $8, $9, $10 );
63 $SIG{HUP} = sub { $eof=1 };
66 hostname => $hostname,
67 start => timelocal($sec, $min, $hours, $mday, $mon{lc($mon)}, $year),
68 mountpoint => $mountpoint,
70 useragent => $useragent,
73 $SIG{'HUP'} = sub { print "EOF\n"; exit; };