Compare commits
4 Commits
171cdbe676
...
5dff2a6919
Author | SHA1 | Date | |
---|---|---|---|
|
5dff2a6919 | ||
|
224ddd931d | ||
|
034d12a85e | ||
|
0de191f904 |
15
etc/logrotate.d/pilerbackup
Normal file
15
etc/logrotate.d/pilerbackup
Normal file
@ -0,0 +1,15 @@
|
||||
### Rotate backup log file
|
||||
|
||||
# location of log file (-l parameter of script file)
|
||||
/path/to/backup.log {
|
||||
|
||||
# rotate log file weekly -- you could also use 'daily', 'monthly' or
|
||||
# specify a size using 'size 100k', for example
|
||||
weekly
|
||||
|
||||
# keep 4 weeks of old logs (4 files) and delete older ones
|
||||
rotate 4
|
||||
|
||||
# compress old log files using gzip (default)
|
||||
compress
|
||||
}
|
13
etc/logwatch/conf/logfiles/pilerbackup.conf
Normal file
13
etc/logwatch/conf/logfiles/pilerbackup.conf
Normal file
@ -0,0 +1,13 @@
|
||||
# Location of your script's log file, -l parameter
|
||||
LogFile = /path/to/your/backup.log
|
||||
|
||||
# Format of logrotate archives for your script. Example assumes compression and
|
||||
# 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' function in the backup
|
||||
# script in which case you will want to update the regex in the custom pl script
|
||||
# below
|
||||
*sqFullStampAnywhere
|
9
etc/logwatch/conf/services/pilerbackup.conf
Normal file
9
etc/logwatch/conf/services/pilerbackup.conf
Normal file
@ -0,0 +1,9 @@
|
||||
# Name of the logfile group without any extension
|
||||
LogFile = pilerbackup
|
||||
|
||||
# Heading displayed on Logwatch's report for this service
|
||||
Title = "Archived mail backup (piler)"
|
||||
|
||||
# Override the detail level for this service
|
||||
# Remember the levels are: 0, 1-4, 5, 6+
|
||||
# Detail = 0
|
112
etc/logwatch/scripts/services/pilerbackup
Normal file
112
etc/logwatch/scripts/services/pilerbackup
Normal file
@ -0,0 +1,112 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
#############################################################################
|
||||
# $Id$
|
||||
#############################################################################
|
||||
# Log: Piler exported EML backup (pilerbackup, Logwatch group 'pilerbackup')
|
||||
# Revision 1.1 2019/07/20
|
||||
# Written by Asif Bacchus
|
||||
#############################################################################
|
||||
|
||||
|
||||
use strict;
|
||||
|
||||
### Get Logwatch detail level (default to 0)
|
||||
my $detailLevel = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
|
||||
|
||||
|
||||
### Declare variables
|
||||
my $summaryErr;
|
||||
my $summaryWarn;
|
||||
my $summarySuccess;
|
||||
|
||||
my %reportHash = ();
|
||||
my $key;
|
||||
|
||||
|
||||
### Minimal detail level: provide summary data only
|
||||
if ($detailLevel == 0) {
|
||||
### process logfile and summarize message types
|
||||
while (defined(my $ThisLine = <STDIN>)) {
|
||||
if ($ThisLine =~ /\-- \[ERROR\] /) {
|
||||
$summaryErr++;
|
||||
}
|
||||
elsif ($ThisLine =~ /\-- \[WARNING\] /) {
|
||||
$summaryWarn++;
|
||||
}
|
||||
elsif ($ThisLine =~ /All processes completed successfully/) {
|
||||
$summarySuccess++;
|
||||
}
|
||||
}
|
||||
|
||||
### fill hash table with headings and summary counts
|
||||
if ($summarySuccess > 0) {
|
||||
$reportHash{"All processes successfully completed"} = $summarySuccess;
|
||||
}
|
||||
if ($summaryWarn > 0) {
|
||||
$reportHash{"Warnings issued"} = $summaryWarn;
|
||||
}
|
||||
if ($summaryErr > 0) {
|
||||
$reportHash{"Errors encountered"} = $summaryErr;
|
||||
}
|
||||
|
||||
### print hash table
|
||||
foreach $key (sort keys %reportHash) {
|
||||
print "$key: $reportHash{$key}\n";
|
||||
}
|
||||
}
|
||||
### Levels 1-4 provide the actual error, warning and success messages instead
|
||||
### of a summary count
|
||||
elsif ($detailLevel >= 1 && $detailLevel <= 4) {
|
||||
while (defined(my $ThisLine = <STDIN>)) {
|
||||
if ($ThisLine =~ /\-- \[ERROR\] /) {
|
||||
print $ThisLine;
|
||||
}
|
||||
elsif ($ThisLine =~ /\-- \[WARNING\] /) {
|
||||
print $ThisLine;
|
||||
}
|
||||
elsif ($ThisLine =~ /\-- \[SUCCESS\] /) {
|
||||
print $ThisLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
### Level 5 is similiar to levels 1-4 except it also reports informational
|
||||
### messages such as the location of script created files, variable checks,
|
||||
### etc. This is useful when verifying the script's operation.
|
||||
elsif ($detailLevel == 5) {
|
||||
while (defined(my $ThisLine = <STDIN>)) {
|
||||
if ($ThisLine =~ /\-- \[ERROR\] /) {
|
||||
print $ThisLine;
|
||||
}
|
||||
elsif ($ThisLine =~ /\-- \[WARNING\] /) {
|
||||
print $ThisLine;
|
||||
}
|
||||
elsif ($ThisLine =~ /\-- \[SUCCESS\] /) {
|
||||
print $ThisLine;
|
||||
}
|
||||
elsif ($ThisLine =~ /\-- \[INFO\] /) {
|
||||
print $ThisLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
### Any level above 5 will echo the entire log including the debugging notes
|
||||
### within the script meant for troubleshooting. Using this level of detail
|
||||
### should only be done if you cannot view the actual log file directly for
|
||||
### whatever reason. The actual log file is colour-coded for easier debugging.
|
||||
elsif ($detailLevel > 5) {
|
||||
while (defined(my $ThisLine = <STDIN>)) {
|
||||
print $ThisLine;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
### Exit gracefully
|
||||
exit (0);
|
||||
|
||||
# vi: shiftwidth=3 tabstop=3 et
|
||||
# Local Variables:
|
||||
# mode: perl
|
||||
# perl-indent-level: 3
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
37
etc/logwatch/scripts/shared/sqlfullstampanywhere
Normal file
37
etc/logwatch/scripts/shared/sqlfullstampanywhere
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
##########################################################################
|
||||
# $Id$
|
||||
##########################################################################
|
||||
|
||||
###############################################################################
|
||||
## 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 ) {
|
||||
print STDERR "DEBUG: Inside FullDateTime...\n";
|
||||
print STDERR "DEBUG: Looking For: " . $SearchDate . "\n";
|
||||
}
|
||||
|
||||
while (defined($ThisLine = <STDIN>)) {
|
||||
### specify the regex that defines how to find 'SearchDate'
|
||||
if ($ThisLine =~ m/\[$SearchDate\] /o) {
|
||||
print $ThisLine;
|
||||
}
|
||||
}
|
||||
|
||||
# vi: shiftwidth=3 syntax=perl tabstop=3 et
|
||||
# Local Variables:
|
||||
# mode: perl
|
||||
# perl-indent-level: 3
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
26
pilerBackup/503_backup.html
Normal file
26
pilerBackup/503_backup.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>503 - Unavailable: Backup in progress</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
width: 85%;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Bad timing!</h1>
|
||||
<p>Seems you're trying to access me during my daily backup window. Don't worry though, I should be up and running again very soon.</p>
|
||||
<p>My average backup window duration is pretty short and I'm quite busy during that time copying your super-important stuff to my secure hiding place so they stay safe in case anything ever happens to me!</p>
|
||||
<h3><em>I'm really sorry for the delay. Please try me again soon!</em></h3>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user