#!/usr/bin/perl -w
$ip=32;
$year=2009;
open WWW,"/2009/05/27/access.log";
@mini=qw(21 22);
@send=qw(00 01 02 );
#open IN,">>result.log";
my $num=0;
my @tmp[50]=(0);
$PerlParsingFormat="([^ ]+) [^ ]+ ([^\\[]+) \\[([^ ]+) [^ ]+\\] \\\"([^ ]+) ([^ ]+) [^\\\"]+\\\" ([\\d|-]+) ([\\d|-]+) \\\"(.*?)\\\" \\\"([^\\\"]*)\\\"";
my $line;
my $tmp=0;
while($line=){
chomp $line;
my @field=();
@field=map(/$PerlParsingFormat/,$line);
# print "$field[5]\n";
foreach $mini (@mini){
if( $line ~= /${year}:${mini}:${send[0]}/){
if($field[5] == 200 || $field[5] == 304){
$tmp[0]+=1;
}
}
if( $line =~ /${year}:${mini}:${send[1]}/){
if($field[5] == 200 || $field[5] == 304){
$tmp[1]+=1;
}
}
if( $line =~ /${year}:${mini}:${send[2]}/){
if($field[5] == 200 || $field[5] == 304){
$tmp[2]+=1;
}
}
}
}
阅读(624) | 评论(0) | 转发(0) |