Remove time from logwatch reports

John Wilcock john at tradoc.fr
Fri Feb 3 12:48:13 GMT 2006


Mike Tremaine wrote:
> In the long run as soon as I upgrade to 4.50 I'll patch the mailscanner
> script to do the right thing.

Here's a patch (against logwatch 7.2.1) that should do the trick - 
ignoring MailScanner's new batch timing lines and reporting on the 
number of SA cache hits.

John.

-- 
-- Over 3000 webcams from ski resorts around the world - www.snoweye.com
-- Translate your technical documents and web pages    - www.tradoc.fr
-------------- next part --------------
--- mailscanner-lw721	2006-02-02 11:18:13.000000000 +0100
+++ mailscanner	2006-02-03 13:29:10.000000000 +0100
@@ -87,7 +87,12 @@
          ( $ThisLine =~ m/^Started SQL Logging child/ ) or
          ( $ThisLine =~ m/^Starting up SQL Whitelist|Blacklist/ ) or
          ( $ThisLine =~ m/^Read .+ whitelist|blacklist entries/ ) or
-         ( $ThisLine =~ m/^Closing down by-domain spam whitelist|blacklist/ ) 
+         ( $ThisLine =~ m/^Closing down by-domain spam whitelist|blacklist/ ) or
+         ( $ThisLine =~ m/^Connected to SpamAssassin cache database/ ) or
+         ( $ThisLine =~ m/^Using SpamAssassin results cache/ ) or
+         ( $ThisLine =~ m/^Expired .+ records from the SpamAssassin cache/ ) or
+         ( $ThisLine =~ m/^Batch processed in .+ seconds/ ) or
+         ( $ThisLine =~ m/^\"Always Looked Up Last\" took .+ seconds/ ) 
    ) {
       # We don't care about these
    } elsif ( $ThisLine =~ m/New Batch: Scanning ([0-9]+) messages, ([0-9]+) bytes/i) {
@@ -236,8 +241,10 @@
       $ImgTagSource{$1}++;
    } elsif ($ThisLine =~ m/Logged to MailWatch SQL/) {
       $MailWatchSQL++;
-   } elsif ($ThisLine =~ m/Quarantining modified message for .+/) {
+   } elsif ($ThisLine =~ m/Quarantining modified message for/) {
       $DisarmedQuarantined++;
+   } elsif ($ThisLine =~ m/SpamAssassin cache hit for message/) {
+      $SACacheHit++;
    } else {
       chomp($ThisLine);
       # Report any unmatched entries...
@@ -271,6 +278,10 @@
    }
 }
 
+if ($SACacheHit > 0) {
+   print "\n\t\t" . $SACacheHit . ' hits from MailScanner SpamAssassin cache';
+}
+
 if ($MailScan_Unscanned > 0) {
    print "\n\t" . $MailScan_Unscanned . ' Messages forwarded unscanned by MailScanner';
 }


More information about the MailScanner mailing list