Hope somebody can help me. I'm attempting to write a perl script that
will rip through the log files and pull out connection stats for the last
5 minutes so that I can graph the results to get an idea of server usage
and such. I'm getting stuck on 1 regex match though that just isn't
working and I'm hoping somebody out there can see what I'm doing wrong.
Heres a snipet:
my $date = `date +%F`;
my $hour = `date +%H`;
my $min = `date +%M`;
chomp($date);
chomp($hour);
chomp($min);
$min =~ /([0-9])([0-9])/;
my $mf = $1;
my $ml = $2;
my $ms = 0;
my $me = 4;
while ( <LOG> ) {
if ( /^$date $hour:$mf[$ms-$me]/ ) {
if ( /status: / ) {
print $_;
}
}
}
--End Snipet--
Now the one that is giving me hell is the:
if ( /^$date $hour:$mf[$ms-$me]/ ) {
This will for instance match '2004-10-06 14:4' however it will not do
'2004-10-06 14:40' directly. Can anybody see what I'm doing wrong?
Thanks,
Ed McLain