changeset 127:bafd91f195de puppet-3.6

Fix PHP reporting in logwatch * Read correct files * Filter correct date format (as per Apache config) * Don't do "next unless" filtering in script * Handle Apache 2.4 date format
author IBBoard <dev@ibboard.co.uk>
date Sat, 17 Sep 2016 15:19:54 +0100
parents 8316d4e55e92
children 379089631403
files common/logwatch/logfiles_php.conf common/logwatch/scripts_php
diffstat 2 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/common/logwatch/logfiles_php.conf	Tue Sep 13 21:04:40 2016 +0100
+++ b/common/logwatch/logfiles_php.conf	Sat Sep 17 15:19:54 2016 +0100
@@ -1,21 +1,22 @@
-##########################################################################
-# Logfile definition for PHP which points to a dedicated PHP log file
-# or to the Apache error log
-# File is to be placed in
-#	/etc/logwatch/conf/logfiles/php.conf
-##########################################################################
+########################################################
+# Logfile definition for PHP which points to Apache logs
+########################################################
 
 # What actual file?  Defaults to LogPath if not absolute path....
-LogFile = httpd/php_log
-LogFile = httpd/error_log
+LogFile = apache/error_*.log
+LogFile = apache/error_*.log.1
 
-# adjust your php.ini accordingly:
-# error_log = /var/log/httpd/php_log
-# log_errors = On
 
 # If the archives are searched, here is one or more line
 # (optionally containing wildcards) that tell where they are...
-#If you use a "-" in naming add that as well -mgt
-Archive = httpd/php_log.*
-Archive = httpd/error_log.*
+Archive = apache/error_*.log.*.gz
+
+# Expand the repeats (actually just removes them now)
+*ExpandRepeats
+
 
+# Keep only the lines in the proper date range...
+#*ApplyHttpErrorDate
+*ApplyStdDate = "\[%a %b %d %H:%M:%S.\d{6} %Y\]"
+
+# vi: shiftwidth=3 tabstop=3 et
--- a/common/logwatch/scripts_php	Tue Sep 13 21:04:40 2016 +0100
+++ b/common/logwatch/scripts_php	Sat Sep 17 15:19:54 2016 +0100
@@ -44,9 +44,7 @@
 # counting messages
 while(<>) {
     my $line = $_;
-    # skipping messages that are not within the requested range
-    next unless $line =~ /^\[($filter)\]/o;
-    $1 =~ /(\w+) (\w+) (\d+) (\d+):(\d+):(\d+) (\d+)/;
+    $line =~ /(\w+) (\w+) (\d+) (\d+):(\d+):(\d+)\.\d{6} (\d+)/;
     my $time;
 
     {