in reply to parse gzipped weblogs
As for your third question, I'm not quite sure what you mean. I tend to use Date::Manip for all of my happy-fun date processing.use strict; use warnings; use IO::Zlib; # also uses Compress::Zlib my @hostnames = qw(baloo beast belle chip cogsworth lefou potts); my $timestamp = $ARGV[0]; foreach my $host ( @hostnames ) { my $logpath = "/archive/$host/www/logs/access_log.$timestamp"; my $fh = IO::Zlib->new($logpath, "r"); die "Cannot open $logpath: $!" if !$fh; # Probably good to check Compress::Zlib::gzerrno, too. while ( <$fh> ) { # do text processing here }; $fh->close; }
|
|---|