Fwd: Suggested patch for /usr/share/logwatch/scripts/services/exim
"Kirk Bauer" <[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
---------- Forwarded message ---------- From: Steve Holden <[email protected]> Date: Jan 7, 2008 10:57 AM Subject: Suggested patch for /usr/share/logwatch/scripts/services/exim To: [email protected] Hi, folks Many thanks for logwatch :-) I've run into problems when running its Exim script against a reasonably large (million line) log file on one of our mailhubs. It takes hours, rather than minutes, to run. The comments in the /usr/share/logwatch/scripts/services/exim script suggest that 'push' should be used instead of the @array = (@array, $line) style used - and they're quite right; doing so improves performance by orders of magnitude (see the figures below). Patch (from diff -u) attached against CVS HEAD (version 1.20). HTH... Kind regards, Steve Holden Network Services University of Brighton UK Time to process 100,000-line log file using default exim script (v1.18 as supplied with RHEL5, but v1.20 results are similar): # time head -100000 /var/log/exim/main-test.log | \ perl -I /usr/share/logwatch/lib \ /usr/share/logwatch/scripts/services/exim Without using 'push': real 33m15.322s user 33m14.402s sys 0m0.370s Using 'push': real 0m3.910s user 0m3.630s sys 0m0.107s NB similar results with CVS HEAD version (v1.20) of exim script. Environment RHEL5 x86_64 with latest patches # uname -a Linux europa.brighton.ac.uk 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:14 EST 2007 x86_64 x86_64 x86_64 GNU/Linux # logwatch --version Logwatch 7.3 (released 03/24/06) # head -3 /usr/share/logwatch/scripts/services/exim ######################################################################## ## # $Id: exim,v 1.18 2006/03/02 16:22:23 bjorn Exp $ ######################################################################## ## # perl --version This is perl, v5.8.8 built for x86_64-linux-thread-multi -- Kirk Bauer <[email protected]> http://linux.kaybee.org | www.logwatch.org Author, Automating UNIX & Linux Administration _______________________________________________ Logwatch-Devel mailing list [email protected] http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
logwatch-scripts-services-exim-1.20.patch
(application/octet-stream, 1.5 KB)
--- logwatch-scripts-services-exim-1.20 2008-01-07 15:26:55.000000000 +0000
+++ logwatch-scripts-services-exim-1.20-patched 2008-01-07 15:31:30.000000000 +0000
@@ -217,12 +217,10 @@
$Proto{$ThisLine}++;
}
elsif ( $ThisLine =~ /SIGHUP received\: re-exec/ ) {
- # I should probably 'push' this, but this seems cleaner.
- @Restart = (@Restart, "$year1-$month1-$day1 $h1:$m1:$s1 (stop)");
+ push @Restart, "$year1-$month1-$day1 $h1:$m1:$s1 (stop)";
}
elsif ( $ThisLine =~ /daemon started\:/ ) {
- # I should probably 'push' this, but this seems cleaner.
- @Restart = (@Restart, "$year1-$month1-$day1 $h1:$m1:$s1 (start)");
+ push @Restart, "$year1-$month1-$day1 $h1:$m1:$s1 (start)";
}
elsif ( $ThisLine =~ /rejected RCPT.*greylist/) {
$Greylist++;
@@ -230,15 +228,15 @@
}
elsif ( $ThisLine =~ /refused relay/ || $ThisLine =~ /rejected RCPT/ ) {
$Relay++;
- @RelayH = (@RelayH, $ThisLine);
+ push @RelayH, $ThisLine;
}
elsif ( $ThisLine =~ /no host name found for IP address/ ) {
$ReverseLookup++;
- @ReverseLookupH = (@ReverseLookupH, $ThisLine);
+ push @ReverseLookupH, $ThisLine;
}
elsif ( $ThisLine =~ /no IP address found for host/ ) {
$Lookup++;
- @LookupH = (@LookupH, $ThisLine);
+ push @LookupH, $ThisLine;
}
elsif ( $ThisLine =~ /^\d+\-\d+\-\d+\s\d+\:\d+\:\d+\s\w+\-\w+\-\w+\s/ ) { # inne wiadomosci przesylane przez EXIMA
# Collect Message ID specific notes...