feat(logwatch): Update logwatch files for v3
Add new timestamp template and delete the old one. Update report script file to use new 'status' tags to generate logwatch reports.
This commit is contained in:
@@ -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
|
||||
*iso8601timestamp
|
||||
@@ -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 = <STDIN>)) {
|
||||
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 = <STDIN>)) {
|
||||
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 = <STDIN>)) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -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 = <STDIN>)) {
|
||||
### specify the regex that defines how to find 'SearchDate'
|
||||
if ($ThisLine =~ m/\[$SearchDate\] /o) {
|
||||
if ($ThisLine =~ m/^$SearchDate /o) {
|
||||
print $ThisLine;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user