Re: named lame server info patch

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

Was this patch forgotten?
I'm resending it + started to work on samba4 dlz entries (which really
clutter the log file). Most are ignored except denied updates which seem to
be important enough to be mentioned in the report.

Regards,
gulikoza

-----Original Message-----
From: gulikoza [mailto:[email protected]] 
Sent: Sunday, September 22, 2013 12:46 PM
To: [email protected]
Subject: named lame server info patch

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

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems

_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel
logwatch-named-lameserver+dlz.patch (application/octet-stream, 2.6 KB)
Index: scripts/services/named
===================================================================
--- scripts/services/named	(revision 197)
+++ 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 '(.*)'/ ) ) {
@@ -388,6 +388,11 @@
       $NoSOA{$Client}++;
    } elsif (($Hint) = ($ThisLine =~ /checkhints: (.*)/) ) {
       $Hints{$Hint}++;
+   } elsif ($ThisLine =~ /^samba_dlz:/) {
+      if ( ($Rhost, $Error) = ($ThisLine =~ /disallowing update of signer=.* name=(.*) type=.* error=(.*)/ )) {
+            $UpdateDenied{"$Rhost ($Error)"}++;
+      }
+      # ignore rest of samba4 dlz entries for now
    } else {
       # Report any unmatched entries...
       # remove PID from named messages
@@ -538,10 +543,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.