# HG changeset patch # User IBBoard # Date 1474121994 -3600 # Node ID bafd91f195ded01e1446ffe1eb455342997af9c8 # Parent 8316d4e55e92f749127cf79c8c0e800768456d3d 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 diff -r 8316d4e55e92 -r bafd91f195de common/logwatch/logfiles_php.conf --- 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 diff -r 8316d4e55e92 -r bafd91f195de common/logwatch/scripts_php --- 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; {