in reply to parse gzipped weblogs
you can put your code in <code></code> tags to keep it nice and easy to read. and you can just decompress on the fly if you need to. you should check the timestamp to make sure somebody doesn't try '20030201;rm -rf /;' or something else nasty.
@hostnames = qw(baloo beast belle chip cogsworth lefou potts); my $timestamp=$ARGV[0]; for my $hostname (@hostnames){ my $logpath = "/archive/$hostname/www/logs/access_log.$timestamp"; #print "$logpath\n"; ## change this open (LOGS,"/path/to/gzip -d -c $logpath.gz |") or die "cant open $logpath\n"; while (<LOGS>){ regex{ get valuable data here; } } }
|
|---|