[Logwatch-Devel] patch to http service - summarize particular result codes

David Baldwin david.baldwin at anu.edu.au
Mon Oct 10 19:35:48 MST 2005


Patch against the latest CVS http (1.31).
Adds the ability to specify detail level at which specific URLs will be reported 
for a given status code (e.g. 404, etc).

Configuration - add line to services/http.conf of form:

$http_rc_detail_rep-RC = LEVEL

e.g.

$http_rc_detail_rep-403 = 10
$http_rc_detail_rep-404 = 20

Then generates in http service report:

     403 Forbidden SUMMARY - 133 URLs, total: 309 Time(s)
     404 Not Found SUMMARY - 1645 URLs, total: 2921 Time(s)

David.
-- 
=====================================================================+
David Baldwin                   mailto:David.Baldwin at anu.edu.au      |
Supercomputer Facility          URL: http://www.anu.edu.au/~u8611156 |
II Services, Huxley Building    Ph:  {intl+61+2 | (02)} 6125 0321    |
Australian National University  FAX: {intl+61+2 | (02)} 6125 8199    |
Canberra ACT 0200, AUSTRALIA  *======================================+
-------------- next part --------------
--- scripts/services/http       7 Sep 2005 21:03:39 -0000       1.31
+++ scripts/services/http       11 Oct 2005 02:25:38 -0000
@@ -675,9 +675,20 @@
       if (not defined $StatusCode{$code}) {
          $StatusCode{$code} = "\(undefined\)";
       }
-      print "   $code $StatusCode{$code}\n";
-      for my $url (sort keys %{$needs_exam{$code}}) {
-         print "      $url: $needs_exam{$code}{$url} Time(s)\n";
+      if( ($ENV{"http_rc_detail_rep-$code"} || $detail) > $detail ) {
+      # only display summary for this code
+         my $t = 0;
+         my $u = 0;
+         foreach my $k ( keys %{$needs_exam{$code}}) {
+            $u += 1;
+            $t += $needs_exam{$code}{$k};
+         }
+         print "   $code $StatusCode{$code} SUMMARY - $u URLs, total: $t Time(s)\n";
+      } else {
+         print "   $code $StatusCode{$code}\n";
+         for my $url (sort keys %{$needs_exam{$code}}) {
+            print "      $url: $needs_exam{$code}{$url} Time(s)\n";
+         }
       }
    }
 }



More information about the Logwatch-Devel mailing list