diff --git a/etc/logwatch/conf/logfiles/cfddns.conf b/etc/logwatch/conf/logfiles/cfddns.conf index ba3a5b1..4914b80 100644 --- a/etc/logwatch/conf/logfiles/cfddns.conf +++ b/etc/logwatch/conf/logfiles/cfddns.conf @@ -10,4 +10,4 @@ Archive = /path/to/your/logfile.ext.?.gz # You don't need to change this unless you have altered the 'stamp' variable in # the script in which case you will want to update the regex in the custom pl # script below -*sqFullStampAnywhere \ No newline at end of file +*iso8601timestamp \ No newline at end of file diff --git a/etc/logwatch/scripts/services/cfddns b/etc/logwatch/scripts/services/cfddns index d260ad8..3966c99 100644 --- a/etc/logwatch/scripts/services/cfddns +++ b/etc/logwatch/scripts/services/cfddns @@ -4,7 +4,7 @@ # $Id$ ############################################################################# # Log: CloudFlare updater script (cfddns) -# Revision 2.1 2021/05/08 +# Revision 3.0 2026/07/25 # Written by Asif Bacchus ############################################################################# @@ -31,22 +31,22 @@ my $key; if ($detailLevel == 0) { ### process logfile and summarize message types while (defined(my $ThisLine = )) { - if ($ThisLine =~ /ERR: Unable to update IP address/) { + if ($ThisLine =~ /[FAIL] Unable to update the IP address for/) { $summaryFailedUpdate++; } - elsif ($ThisLine =~ /ERROR: /) { + elsif ($ThisLine =~ /[FAIL] /) { $summaryErr++; } - elsif ($ThisLine =~ /WARN: Cannot find existing record/) { + elsif ($ThisLine =~ /[WARN] Cannot find an existing record matching/) { $summaryInvalidHost++; } - elsif ($ThisLine =~ /WARNING: /){ + elsif ($ThisLine =~ /[WARN] /){ $summaryWarning++; } - elsif ($ThisLine =~ /SUCCESS: /) { + elsif ($ThisLine =~ /[SUCCESS] /) { $summaryUpdated++; } - elsif ($ThisLine =~ /already up-to-date/) { + elsif ($ThisLine =~ /already up to date/) { $summaryUpToDate++; } } @@ -56,7 +56,7 @@ if ($detailLevel == 0) { $reportHash{"Entries successfully updated"} = $summaryUpdated; } if ($summaryUpToDate > 0) { - $reportHash{"Entries already up-to-date"} = $summaryUpToDate; + $reportHash{"Entries already up to date"} = $summaryUpToDate; } if ($summaryFailedUpdate > 0) { $reportHash{"Hosts failed to update"} = $summaryFailedUpdate; @@ -80,16 +80,16 @@ if ($detailLevel == 0) { ### a summary count elsif ($detailLevel >= 1 && $detailLevel <= 4) { while (defined(my $ThisLine = )) { - if ($ThisLine =~ /ERR: /) { + if ($ThisLine =~ /[ERR] /) { print $ThisLine; } - elsif ($ThisLine =~ /WARN: /) { + elsif ($ThisLine =~ /[WARN] /) { print $ThisLine; } - elsif ($ThisLine =~ /SUCCESS: /) { + elsif ($ThisLine =~ /[SUCCESS] /) { print $ThisLine; } - elsif ($ThisLine =~ /already up-to-date/) { + elsif ($ThisLine =~ /already up to date/) { print $ThisLine; } } @@ -98,25 +98,19 @@ elsif ($detailLevel >= 1 && $detailLevel <= 4) { ### debugging messages elsif ($detailLevel == 5) { while (defined(my $ThisLine = )) { - if ($ThisLine =~ /ERR: /) { - print $ThisLine; - } - elsif ($ThisLine =~ /ERROR: /) { + if ($ThisLine =~ /[ERR] /) { print $ThisLine; } elsif ($ThisLine =~ /CF-ERR: /) { print $ThisLine; } - elsif ($ThisLine =~ /WARN: /) { + elsif ($ThisLine =~ /[WARN] /) { print $ThisLine; } - elsif ($ThisLine =~ /WARNING: /) { + elsif ($ThisLine =~ /[SUCCESS] /) { print $ThisLine; } - elsif ($ThisLine =~ /SUCCESS: /) { - print $ThisLine; - } - elsif ($ThisLine =~ /already up-to-date/) { + elsif ($ThisLine =~ /already up to date/) { print $ThisLine; } } diff --git a/etc/logwatch/scripts/shared/sqfullstampanywhere b/etc/logwatch/scripts/shared/iso8601timestamp similarity index 77% rename from etc/logwatch/scripts/shared/sqfullstampanywhere rename to etc/logwatch/scripts/shared/iso8601timestamp index b123036..b2f6f4b 100644 --- a/etc/logwatch/scripts/shared/sqfullstampanywhere +++ b/etc/logwatch/scripts/shared/iso8601timestamp @@ -5,9 +5,8 @@ ########################################################################## ############################################################################### -## 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]' +## Filter dates in ISO-8601 format located at the start of a given line +## Format: '%Y-%m-%dT%H:%M:%SZ' ############################################################################### use Logwatch ':dates'; @@ -15,7 +14,7 @@ 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'); +$SearchDate = TimeFilter('%Y-%m-%dT%H:%M:%SZ'); if ( $Debug > 5 ) { print STDERR "DEBUG: Inside FullDateTime...\n"; @@ -24,7 +23,7 @@ if ( $Debug > 5 ) { while (defined($ThisLine = )) { ### specify the regex that defines how to find 'SearchDate' - if ($ThisLine =~ m/\[$SearchDate\] /o) { + if ($ThisLine =~ m/^$SearchDate /o) { print $ThisLine; } }