Apache Requests Per Minute

From S23Wiki
(Redirected from APache Requests Per Minute)
Jump to: navigation, search

run like this:

perl rpm.pl < logfile.log > outputfile.out

#!/usr/bin/perl
while (<>) {
#[01/Oct/2004:00:00:01 +0000]
        if (/\[\d{2}\/[A-Za-z]{3}\/\d{4}:(\d\d):(\d\d)/) {
                $h=$1;
                $m=$2;

                if ($m == $lastm) {
                        $cpm++;
                } else {
                        print "$h:$lastm:$cpm\n";
                 $lastm=$m;
                 $cpm=1;
                }
        }
}