http-error improvements
Orion Poplawski <[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
The attached patch does two things: - Drops using ApplyhttpDate since the time format in the error log (at least in Fedora/RedHat is different). See https://bugzilla.redhat.com/show_bug.cgi?id=881111 - Looks like there still needs to be a more general fix. - Adds the ability to ignore "does not exist" messages with or without the referer tag. Often this is from sites requesting items that just don't exists anymore. -- Orion Poplawski Technical Manager 303-415-9701 x222 NWRA, Boulder Office FAX: 303-415-9702 3380 Mitchell Lane [email protected] Boulder, CO 80301 http://www.nwra.com ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 _______________________________________________ Logwatch-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/logwatch-devel
logwatch-http-error.patch
(text/x-patch, 2.1 KB)
Index: conf/logfiles/http-error.conf
===================================================================
--- conf/logfiles/http-error.conf (revision 127)
+++ conf/logfiles/http-error.conf (working copy)
@@ -33,8 +33,4 @@
# Expand the repeats (actually just removes them now)
*ExpandRepeats
-
-# Keep only the lines in the proper date range...
-*ApplyhttpDate
-
# vi: shiftwidth=3 tabstop=3 et
Index: conf/services/http-error.conf
===================================================================
--- conf/services/http-error.conf (revision 127)
+++ conf/services/http-error.conf (working copy)
@@ -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
Index: scripts/services/http-error
===================================================================
--- scripts/services/http-error (revision 127)
+++ scripts/services/http-error (working copy)
@@ -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;