[Logwatch-Devel] Re: logwatch script update for slon (Slony daemon)

Jeff Frost jeff at frostconsultingllc.com
Wed Sep 28 09:10:20 MST 2005


After running on my replication server for a little while, I've made a few 
changes to the ignores and items that get counted in the slon script.  Below 
is the diff -u output (let me know if you need it emailed as an attachment or 
something):

I also have a simple question...why no #!/usr/bin/perl at the top of the perl 
scripts?  If the filter is a perl script it is automatically run as perl, but 
if they are shell, python, etc it needs specifying?

--- logwatch/scripts/services/slon	2005-09-28 09:08:38.000000000 -0700
+++ logwatch/scripts/services/slon.old	2005-09-28 09:08:34.000000000 -0700
@@ -23,98 +23,87 @@

  use Logwatch ':all';

-$Debug = ValueOrDefault($ENV{'LOGWATCH_DEBUG'}, 0);
-$Detail = ValueOrDefault($ENV{'LOGWATCH_DETAIL_LEVEL'}, 0);
-
-# Avoid "Use of uninitialized value" warning messages.
-sub ValueOrDefault {
-         my ($value, $default) = @_;
-         return ($value ? $value : $default);
-}
+$Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
+$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;

  if ( $Debug >= 5 ) {
-         print STDERR "\n\nDEBUG: Inside SLON Filter \n\n";
-         $DebugCounter = 1;
+          print STDERR "\n\nDEBUG: Inside SLON Filter \n\n";
+          $DebugCounter = 1;
  }

  while (defined($ThisLine = <STDIN>)) {
-    if ( $Debug >= 5 ) {
-       print STDERR "DEBUG($DebugCounter): $ThisLine";
-       $DebugCounter++;
-    }
-    chomp($ThisLine);
-    if ( 0 or
-        ($ThisLine =~ m/new sl_action_seq/) or 
-        ($ThisLine =~ m/new sl_rowid_seq value/) or
-        ($ThisLine =~ m/seconds delay for first row/) or
-        ($ThisLine =~ m/seconds until close cursor/) or
-        ($ThisLine =~ m/syncing set \d+ with .* from provider/) or
-        ($ThisLine =~ m/no sets need syncing/) or
-	($ThisLine =~ m/SYNC \d+ processing/)
-    ) {
-       # Ignore these
-    } elsif ($ThisLine =~ m/main process started/) {
-      $Starts++;
-    } elsif ($ThisLine =~ m/exit/) {
-      $Kills++;
-    } elsif ($ThisLine =~ m/Received event/) {
-      $ReceivedEvent++;
-    } elsif ($ThisLine =~ m/forward confirm/) {
-      $ForwardConfirm++;
-    } elsif ($ThisLine =~ m/queue event/) {
-      $QueueEvent++;
-    } elsif ($ThisLine =~ m/SYNC \d+ done/) {
-      $SyncsProcessed++;
-    } elsif ($ThisLine =~ m/cleanupThread:/) {
-      $CleanupThread++;
-    } elsif ($ThisLine =~ m/ERROR/) {
-      $Errors++;
-      push @ErrorList, "$ThisLine\n";
-    } else {
-       # Report any unmatched entries...
-       push @OtherList, "$ThisLine\n";
-    }
+     if ( $Debug >= 5 ) {
+        print STDERR "DEBUG($DebugCounter): $ThisLine";
+        $DebugCounter++;
+     }
+     chomp($ThisLine);
+     if (
+         ($ThisLine =~ m/new sl_action_seq/) or
+         ($ThisLine =~ m/no sets need syncing/)
+     ) {
+        # Ignore these
+     } elsif ($ThisLine =~ m/main process started/) {
+       $Starts++;
+     } elsif ($ThisLine =~ m/exit/) {
+       $Kills++;
+     } elsif ($ThisLine =~ m/Received event/) {
+       $ReceivedEvent++;
+     } elsif ($ThisLine =~ m/forward confirm/) {
+       $ForwardConfirm++;
+     } elsif ($ThisLine =~ m/queue event/) {
+       $QueueEvent++;
+     } elsif ($ThisLine =~ m/SYNC \d+ processing/) {
+       $SyncsProcessed++;
+     } elsif ($ThisLine =~ m/cleanupThread:/) {
+       $CleanupThread++;
+     } elsif ($ThisLine =~ m/ERROR/) {
+       $Errors++;
+       push @ErrorList, "$ThisLine\n";
+     } else {
+        # Report any unmatched entries...
+        push @OtherList, "$ThisLine\n";
+     }
  }

  ###########################################################

  if ($Detail >= 5) {
-	if ($Kills) {
-	    print "\nSLON Killed: " . $Kills . " Time(s)\n";
-	}
-	if ($Starts) {
-	    print "\nSLON Started: " . $Starts . " Time(s)\n";
-	}
-
-	if ($CleanupThread) {
-	   print "\nSLON CleanupThread Event: " . $CleanupThread . " Time(s)\n";
-	}
-
-	if ($ForwardConfirm) {
-	   print "\nSLON ForwardConfirm Event: " . $ForwardConfirm . " Time(s)\n";
-	}
-
-	if ($ReceivedEvent) {
-	   print "\nSLON Received Event: " . $ReceivedEvent . " Time(s)\n";
-	}
-
-	if ($QueueEvent) {
-	   print "\nSLON Queue Event: " . $QueueEvent . " Time(s)\n";
-	}
-
-	if ($SyncsProcessed) {
-	   print "\nSLON Syncs Processing: " . $SyncsProcessed . " Time(s)\n";
-	}
+ 	if ($Kills) {
+ 	    print "\nSLON Killed: " . $Kills . " Time(s)\n";
+ 	}
+ 	if ($Starts) {
+ 	    print "\nSLON Started: " . $Starts . " Time(s)\n";
+ 	}
+
+ 	if ($CleanupThread) {
+ 	   print "\nSLON CleanupThread Event: " . $CleanupThread . " Time(s)\n";
+ 	}
+
+ 	if ($ForwardConfirm) {
+ 	   print "\nSLON ForwardConfirm Event: " . $ForwardConfirm . " Time(s)\n";
+ 	}
+
+ 	if ($ReceivedEvent) {
+ 	   print "\nSLON Received Event: " . $ReceivedEvent . " Time(s)\n";
+ 	}
+
+ 	if ($QueueEvent) {
+ 	   print "\nSLON Queue Event: " . $QueueEvent . " Time(s)\n";
+ 	}
+
+ 	if ($SyncsProcessed) {
+ 	   print "\nSLON Syncs Processing: " . $SyncsProcessed . " Time(s)\n";
+ 	}
  }

  if ($Errors) {
-    print "\nSLON Errors: " . $Errors . "\n";
-    print @ErrorList;
+     print "\nSLON Errors: " . $Errors . "\n";
+     print @ErrorList;
  }

  if ($#OtherList >= 0) {
-    print "\n**Unmatched Entries**\n";
-    print @OtherList;
+     print "\n**Unmatched Entries**\n";
+     print @OtherList;
  }

  exit(0);

-- 
Jeff Frost, Owner 	<jeff at frostconsultingllc.com>
Frost Consulting, LLC 	http://www.frostconsultingllc.com/
Phone: 650-780-7908	FAX: 650-649-1954


More information about the Logwatch-Devel mailing list