SF.net SVN: logwatch:[135]

[email protected]
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 135
          http://logwatch.svn.sourceforge.net/logwatch/?rev=135&view=rev
Author:   stefjakobs
Date:     2013-02-15 15:31:55 +0000 (Fri, 15 Feb 2013)
Log Message:
-----------
http-error: ignore "does not exist" messages with or without the referer
tag. (Thanks: Orion Poplawski)

Modified Paths:
--------------
    conf/logfiles/http-error.conf
    conf/services/http-error.conf
    scripts/services/http-error

Modified: conf/logfiles/http-error.conf
===================================================================
--- conf/logfiles/http-error.conf	2013-02-15 14:49:30 UTC (rev 134)
+++ conf/logfiles/http-error.conf	2013-02-15 15:31:55 UTC (rev 135)
@@ -36,5 +36,7 @@
 
 # Keep only the lines in the proper date range...
 *ApplyhttpDate
+# or use a custom time filter:
+# *ApplyStdDate = "\[%a %b %d %H:%M:%S %Y\]"
 
 # vi: shiftwidth=3 tabstop=3 et

Modified: conf/services/http-error.conf
===================================================================
--- conf/services/http-error.conf	2013-02-15 14:49:30 UTC (rev 134)
+++ conf/services/http-error.conf	2013-02-15 15:31:55 UTC (rev 135)
@@ -13,3 +13,8 @@
 # PHP notices should be fixed
 Detail = High
 
+# Ignore all "does not exist" messages
+# $ignore_not_exist_all = Yes
+
+# Ignore "does not exist" messages with no "referer:" tag
+# $ignore_not_exist_no_referer = Yes

Modified: scripts/services/http-error
===================================================================
--- scripts/services/http-error	2013-02-15 14:49:30 UTC (rev 134)
+++ scripts/services/http-error	2013-02-15 15:31:55 UTC (rev 135)
@@ -34,6 +34,8 @@
 my $date_format = '... %b %d %H:%M:%S %Y';
 my $filter = TimeFilter($date_format);
 my $detail = exists $ENV{'LOGWATCH_DETAIL_LEVEL'} ? $ENV{'LOGWATCH_DETAIL_LEVEL'} : 0;
+my $Ignore_not_exist_all = $ENV{'ignore_not_exist_all'} || 0;
+my $Ignore_not_exist_no_referer = $ENV{'ignore_not_exist_no_referer'} || 0;
 
 # we do not use any Date:: package (or strptime) as they are probably not available
 my %month2num = ( Jan => 0, Feb => 1, Mar => 2, Apr => 3,
@@ -55,10 +57,15 @@
 # counting messages
 while(<>) {
     my $line = $_;
+    # skip PHP messages (have a separate script)
+    next if $line =~ / PHP (Warning|Fatal error|Notice):/o;
+    # Ignore does not exist messages if asked
+    if ($line =~ /does not exist:/o) {
+       next if $Ignore_not_exist_all;
+       next if $Ignore_not_exist_no_referer and $line !~ /, referer: /o;
+    }
     # skipping messages that are not within the requested range
     next unless $line =~ /^\[($filter)\]/o;
-    # skip PHP messages (have a separate script)
-    next if $line =~ / PHP (Warning|Fatal error|Notice):/o;
     $1 =~ /(\w+) (\w+) (\d+) (\d+):(\d+):(\d+) (\d+)/;
     my $time;
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
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.