Hello PerL adepts. Mine is a newbie problem. I did spend quite a few hours looking for the solution. to no avail.
Let me just say, that it is a priviledge to be in the company of merlyn. And I think that this site is great.
I need to go through seven directories that contain tons of gz logs, I haven't been able to figure out a way to have my program process the gzipped files, currently i give a timestamp as an argument, and all logs from prospective directories with matching timestamp in the name of the file get looked at, they are not compressed, eventually i'll have to give a starting period and an ending period and make it so it's real easy to use for the marketing folk. this is my relevant code:
@hostnames = qw(baloo beast belle chip cogsworth lefou potts);
my $timestamp=$ARGV[0];
for ($c=0; $c<@hostnames; $c++){
my $logpath = "/archive/$hostnames[$c]/www/logs/access_log.$timestamp"
+;
#print "$logpath\n";
open (LOGS,"$logpath") || die "cant open $logpath\n";
while (<LOGS>){
regex{
get valuable data here;
}
}
my questions are several:
1. how do i make this process the gz files? (i tried using * in place of the $timestamp, but that wasnt working, i wonder if i'll have to deflate and then parse(which will take ages))
2. what would be the most elegant way to do the above(1)
3. in your oppinion what is the simplest easiest to use time date parser, and what would be a good way to implement it.
Thank's to everyone that took the time to read this longwinded post. i'd be thrilled to get your stance on this. thanks for the help.
~vili
roaming the perl labyrinth