View Single Post

  #4 (permalink)  
Old 05-07-2008
Kees Nuyt
 
Posts: n/a
Default Re: apache - how to monitor HTTP response codes

On Wed, 7 May 2008 10:05:20 -0700 (PDT), inetquestion
<inetquestion@hotmail.com> wrote:

>Following perl script gives ratio of 404s to all other traffic.
>
>#!/usr/bin/perl
>
>if (my $filename = shift @ARGV) {
> open(DATA, "< $filename") || die ("Could not open file: $filename");
> *STDIN = *DATA;
>}
>
>while (<STDIN>) {
> chomp ($_);
> if (/.* 404 [0-9]*$/) {
> $http404+=1;
> }
> $entriesTotal+=1;
>}
>
>$ratio=$http404*100/$entriesTotal;
>printf "%2.6f\n",$ratio;


Cute.
--
( Kees
)
c[_] Quantum Mechanics: The dreams stuff is made of.
(Steven Wright) (#187)