named lame server info patch

"gulikoza" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Hello,

Lame server resolving line is silently ignored although $LameServer array
exists and would be filled later on if not skipped.
Also, Connection refused messages are completely ignored. These messages
might be interesting to the administrator (network unreachable and host
unreachable are recorded, connection refused is pretty much the same
category IMHO).

The attached patch will enable lame server and connection refused messages
and display these lines in a structured output when Detail >= 10 (as this
was already set for %LameServer).

Regards,
gulikoza

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk

_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel
logwatch-named-lameserver.patch (application/octet-stream, 2.1 KB)
Index: scripts/services/named
===================================================================
--- scripts/services/named	(revision 170)
+++ scripts/services/named	(working copy)
@@ -181,8 +181,6 @@
       ($ThisLine =~ /Response from unexpected source/) or
       ($ThisLine =~ /No root nameservers for class IN/) or
       ($ThisLine =~ /recvfrom: No route to host/) or
-      ($ThisLine =~ /(C|c)onnection refused/) or
-      ($ThisLine =~ /lame server resolving/) or
       ($ThisLine =~ /transfer of/) or
       ($ThisLine =~ /using \d+ CPU/) or
       ($ThisLine =~ /loading configuration/) or
@@ -293,8 +291,10 @@
       $ZoneExpired{$Zone}++;
    } elsif ( ($Zone) = ( $ThisLine =~ /zone (.+)\: loaded serial/ ) ) {
       $ZoneLoaded{$Zone}++;
+   } elsif ( (undef,$Addr,$Server) = ( $ThisLine =~ /(C|c)onnection refused resolving '(.+)': (.+)/ ) ) {
+      $ConnectionRefused{$Addr}{$Server}++;
    } elsif ( (undef,$Addr,undef,$Server) = ( $ThisLine =~ /ame server (on|resolving) '(.+)' \(in .+\):\s+(\[.+\]\.\d+)?\s*'?(.+)'?:?/ ) ) {
-      $LameServer{"$Addr ($Server)"}++;
+      $LameServer{$Addr}{$Server}++;
    } elsif ( ($Zone) = ( $ThisLine =~ /Zone \"(.+)\" was removed/ ) ) {
       $ZoneRemoved{$Zone}++;
    } elsif ( ($Zone) = ( $ThisLine =~ /received notify for zone '(.*)'/ ) ) {
@@ -538,10 +538,23 @@
    }
 }
 
+if ( ( $Detail >= 10 ) and (keys %ConnectionRefused) ) {
+   print "\nConnection refused resolving:\n";
+   foreach $Addr (sort keys %ConnectionRefused) {
+      print "   $Addr:\n";
+      foreach $Server (sort SortIP keys %{$ConnectionRefused{$Addr}}) {
+         print "      $Server: $ConnectionRefused{$Addr}{$Server} Time(s)\n";
+      }
+   }
+}
+
 if ( ( $Detail >= 10 ) and (keys %LameServer) ) {
    print "\nThese addresses had lame server references:\n";
-   foreach $ThisOne (keys %LameServer) {
-      print "   $ThisOne: $LameServer{$ThisOne} Time(s)\n";
+   foreach $Addr (sort keys %LameServer) {
+      print "   $Addr:\n";
+      foreach $Server (sort SortIP keys %{$LameServer{$Addr}}) {
+         print "      $Server: $LameServer{$Addr}{$Server} 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.