Updated Logwatch 'SearchDate' custom script. Renamed it.

Updated notes in LogFile config.
This commit is contained in:
Asif Bacchus 2018-09-26 22:54:14 -06:00
parent 9ba6b40904
commit 47acc2684c
2 changed files with 10 additions and 5 deletions

View File

@ -4,6 +4,8 @@ LogFile = /path/to/your/cfddns.log
# extension preservation
Archive = /path/to/your/logfile.ext.?.gz
# Apply the correct date/time filtering to match the format of the script's log
# We are using a custom pl script in /etc/logwatch/scripts/shared/
# You don't need to change this unless you have altered the 'stamp' variable in
# the script
*applystddate = "%Y-%m-%d %H:%M:%S"
# the script in which case you will want to update the regex in the custom pl
# script below
*sqFullStampAnywhere

View File

@ -5,14 +5,16 @@
##########################################################################
###############################################################################
## Filter dates in full-date-time international format
## Format: '%Y-%m-%d %H:%M:%S'
## Filter dates in full-date-time international format, surrounded by square
## brackets located anywhere on a given line
## Format: '[%Y-%m-%d %H:%M:%S]'
###############################################################################
use Logwatch ':dates';
my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
### Specify the format of the date/time stamp itself
$SearchDate = TimeFilter('%Y-%m-%d %H:%M:%S');
if ( $Debug > 5 ) {
@ -21,7 +23,8 @@ if ( $Debug > 5 ) {
}
while (defined($ThisLine = <STDIN>)) {
if ($ThisLine =~ m/^$SearchDate /o) {
### specify the regex that defines how to find 'SearchDate'
if ($ThisLine =~ m/\[$SearchDate\] /o) {
print $ThisLine;
}
}