Fwd: Patch to sort http errors by frequency

Kirk Bauer <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
------------------------------------------------------
Kirk Bauer <[email protected]>
http://linux.kaybee.org | www.logwatch.org
Author, Automating UNIX & Linux Administration




---------- Forwarded message ----------
From: Sebastien Koechlin <[email protected]>
Date: Tue, Jul 7, 2009 at 4:09 AM
Subject: Patch to sort http errors by frequency
To: [email protected]


Here is a patch to sort http errors by frequency.

On production websites, we alway have a lot of 404 on various files
(scanner, typo...)

It's against debian 7.3.6.cvs20080702-2

--
Sébastien Koechlin

_______________________________________________
Logwatch-Devel mailing list
[email protected]
http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
logwatch.patch (text/x-diff, 575 B)
--- /usr/share/logwatch/scripts/services/http	2008-12-31 12:31:12.000000000 +0100
+++ http	2009-07-07 12:38:37.000000000 +0200
@@ -736,7 +736,7 @@
          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}}) {
+         for my $url (sort { ($needs_exam{$code}{$b} <=> $needs_exam{$code}{$a}) or ($a cmp $b) } keys %{$needs_exam{$code}}) {
             print "      $url: $needs_exam{$code}{$url} Time(s)\n";
          }
       }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.