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
|
# 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
|
# the script in which case you will want to update the regex in the custom pl
|
||||||
# script below
|
# script below
|
||||||
*sqFullStampAnywhere
|
*iso8601timestamp
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Log: CloudFlare updater script (cfddns)
|
# Log: CloudFlare updater script (cfddns)
|
||||||
# Revision 2.1 2021/05/08
|
# Revision 3.0 2026/07/25
|
||||||
# Written by Asif Bacchus
|
# Written by Asif Bacchus
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
@@ -31,22 +31,22 @@ my $key;
|
|||||||
if ($detailLevel == 0) {
|
if ($detailLevel == 0) {
|
||||||
### process logfile and summarize message types
|
### process logfile and summarize message types
|
||||||
while (defined(my $ThisLine = <STDIN>)) {
|
while (defined(my $ThisLine = <STDIN>)) {
|
||||||
if ($ThisLine =~ /ERR: Unable to update IP address/) {
|
if ($ThisLine =~ /[FAIL] Unable to update the IP address for/) {
|
||||||
$summaryFailedUpdate++;
|
$summaryFailedUpdate++;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /ERROR: /) {
|
elsif ($ThisLine =~ /[FAIL] /) {
|
||||||
$summaryErr++;
|
$summaryErr++;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /WARN: Cannot find existing record/) {
|
elsif ($ThisLine =~ /[WARN] Cannot find an existing record matching/) {
|
||||||
$summaryInvalidHost++;
|
$summaryInvalidHost++;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /WARNING: /){
|
elsif ($ThisLine =~ /[WARN] /){
|
||||||
$summaryWarning++;
|
$summaryWarning++;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /SUCCESS: /) {
|
elsif ($ThisLine =~ /[SUCCESS] /) {
|
||||||
$summaryUpdated++;
|
$summaryUpdated++;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /already up-to-date/) {
|
elsif ($ThisLine =~ /already up to date/) {
|
||||||
$summaryUpToDate++;
|
$summaryUpToDate++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ if ($detailLevel == 0) {
|
|||||||
$reportHash{"Entries successfully updated"} = $summaryUpdated;
|
$reportHash{"Entries successfully updated"} = $summaryUpdated;
|
||||||
}
|
}
|
||||||
if ($summaryUpToDate > 0) {
|
if ($summaryUpToDate > 0) {
|
||||||
$reportHash{"Entries already up-to-date"} = $summaryUpToDate;
|
$reportHash{"Entries already up to date"} = $summaryUpToDate;
|
||||||
}
|
}
|
||||||
if ($summaryFailedUpdate > 0) {
|
if ($summaryFailedUpdate > 0) {
|
||||||
$reportHash{"Hosts failed to update"} = $summaryFailedUpdate;
|
$reportHash{"Hosts failed to update"} = $summaryFailedUpdate;
|
||||||
@@ -80,16 +80,16 @@ if ($detailLevel == 0) {
|
|||||||
### a summary count
|
### a summary count
|
||||||
elsif ($detailLevel >= 1 && $detailLevel <= 4) {
|
elsif ($detailLevel >= 1 && $detailLevel <= 4) {
|
||||||
while (defined(my $ThisLine = <STDIN>)) {
|
while (defined(my $ThisLine = <STDIN>)) {
|
||||||
if ($ThisLine =~ /ERR: /) {
|
if ($ThisLine =~ /[ERR] /) {
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /WARN: /) {
|
elsif ($ThisLine =~ /[WARN] /) {
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /SUCCESS: /) {
|
elsif ($ThisLine =~ /[SUCCESS] /) {
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /already up-to-date/) {
|
elsif ($ThisLine =~ /already up to date/) {
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,25 +98,19 @@ elsif ($detailLevel >= 1 && $detailLevel <= 4) {
|
|||||||
### debugging messages
|
### debugging messages
|
||||||
elsif ($detailLevel == 5) {
|
elsif ($detailLevel == 5) {
|
||||||
while (defined(my $ThisLine = <STDIN>)) {
|
while (defined(my $ThisLine = <STDIN>)) {
|
||||||
if ($ThisLine =~ /ERR: /) {
|
if ($ThisLine =~ /[ERR] /) {
|
||||||
print $ThisLine;
|
|
||||||
}
|
|
||||||
elsif ($ThisLine =~ /ERROR: /) {
|
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /CF-ERR: /) {
|
elsif ($ThisLine =~ /CF-ERR: /) {
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /WARN: /) {
|
elsif ($ThisLine =~ /[WARN] /) {
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /WARNING: /) {
|
elsif ($ThisLine =~ /[SUCCESS] /) {
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
elsif ($ThisLine =~ /SUCCESS: /) {
|
elsif ($ThisLine =~ /already up to date/) {
|
||||||
print $ThisLine;
|
|
||||||
}
|
|
||||||
elsif ($ThisLine =~ /already up-to-date/) {
|
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -5,9 +5,8 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## Filter dates in full-date-time international format, surrounded by square
|
## Filter dates in ISO-8601 format located at the start of a given line
|
||||||
## brackets located anywhere on a given line
|
## Format: '%Y-%m-%dT%H:%M:%SZ'
|
||||||
## Format: '[%Y-%m-%d %H:%M:%S]'
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
use Logwatch ':dates';
|
use Logwatch ':dates';
|
||||||
@@ -15,7 +14,7 @@ use Logwatch ':dates';
|
|||||||
my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
|
my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
|
||||||
|
|
||||||
### Specify the format of the date/time stamp itself
|
### 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 ) {
|
if ( $Debug > 5 ) {
|
||||||
print STDERR "DEBUG: Inside FullDateTime...\n";
|
print STDERR "DEBUG: Inside FullDateTime...\n";
|
||||||
@@ -24,7 +23,7 @@ if ( $Debug > 5 ) {
|
|||||||
|
|
||||||
while (defined($ThisLine = <STDIN>)) {
|
while (defined($ThisLine = <STDIN>)) {
|
||||||
### specify the regex that defines how to find 'SearchDate'
|
### specify the regex that defines how to find 'SearchDate'
|
||||||
if ($ThisLine =~ m/\[$SearchDate\] /o) {
|
if ($ThisLine =~ m/^$SearchDate /o) {
|
||||||
print $ThisLine;
|
print $ThisLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user