1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
########################################################
## Copyright (c) 2014 Orion Poplawski
## Covered under the included MIT/X-Consortium License:
## http://www.opensource.org/licenses/mit-license.php
## All modifications and contributions by other persons to
## this script are assumed to have been donated to the
## Logwatch project and thus assume the above copyright
## and licensing terms. If you want to make contributions
## under your own copyright or a different license this
## must be explicitly stated in the contribution an the
## Logwatch project reserves the right to not accept such
## contributions. If you have made significant
## contributions to this script and want to claim
## copyright please contact logwatch-devel@lists.sourceforge.net.
#########################################################
use strict;
my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
my %Errors;
my %Warnings;
my %Startup;
my $Stop;
my %BackupStarted;
my $BackupCompleted;
my %BackupFile;
my %Export;
my %NSSCiphers;
my %SSLInit;
my %Info;
my %OtherList;
my $PreviousLine = '';
while (defined(my $ThisLine = <STDIN>)) {
chomp($ThisLine);
if ($ThisLine =~ /^Listening for new connections again$/
or $ThisLine =~ /Listening on .* (for LDAPI requests|port)/
or $ThisLine =~ /^Waiting for \d+ database threads to stop/
or $ThisLine =~ /^slapd shutting down - /
or $ThisLine =~ /^SSL alert: Configured NSS Ciphers$/
or $ThisLine =~ /^ldbm_back_.* - conn=/
or $ThisLine =~ /^ldbm_usn_init - backend: /
) {
#Ignore
} elsif ($ThisLine =~ /error/i
or $ThisLine =~ /^Detected Disorderly Shutdown/) {
$Errors{$ThisLine}++;
} elsif ($ThisLine =~ /warning/i
or $ThisLine =~ /^Not listening for new connections/) {
$Warnings{$ThisLine}++;
} elsif ($ThisLine =~ /^(.*) starting up$/) {
$Startup{$1}++;
} elsif ($ThisLine =~ /^slapd stopped\.$/) {
$Stop++;
} elsif ($ThisLine =~ /^Beginning backup of '(.*)'$/) {
$BackupStarted{$1}++;
} elsif ($ThisLine =~ /^Backup finished\.$/) {
$BackupCompleted++;
} elsif ($ThisLine =~ /^Backing up file \d+ \((.*)\)$/) {
$BackupFile{$1}++;
} elsif ($ThisLine =~ /^Copying (.*) to /) {
$BackupFile{$1}++;
} elsif ($ThisLine =~ /^export (\w+: Processed \d+ entries \(\d+%\)\.)$/) {
$Export{$1}++;
} elsif ($ThisLine =~ /^SSL alert:\s+(\S+): (\w+)/) {
$NSSCiphers{$1} = $2;
} elsif ($ThisLine =~ /^SSL Initialization - (.*)/) {
$SSLInit{$1}++;
} elsif ($ThisLine =~ /^(Total entry cache size:.*)/
or $ThisLine =~ /^(userRoot: entry cache size:.*)/) {
$Info{$1}++;
} elsif ($ThisLine =~ /^All database threads now stopped$/) {
#This line follows the previous normally in backups or shutdown
$OtherList{$ThisLine}++ unless $PreviousLine =~ /^(export \w+: Processed \d+ entries|Waiting for \d+ database threads to stop|Backing up file|Copying .* to )/;
} else {
$OtherList{$ThisLine}++;
}
$PreviousLine = $ThisLine;
}
if (keys %Errors) {
print "\n** ERRORS **\n";
foreach my $line (sort {$a cmp $b} keys %Errors) {
print " $line: $Errors{$line} Time(s)\n";
}
}
if (keys %Warnings) {
print "\n** Warnings:\n";
foreach my $line (sort {$a cmp $b} keys %Warnings) {
print " $line: $Warnings{$line} Time(s)\n";
}
}
if (keys %Startup and $Detail >= 5) {
foreach my $Version (keys %Startup) {
print "\nStart up version $Version: $Startup{$Version} Time(s)\n";
}
}
if ($Stop and $Detail) {
print "\nStopped: $Stop Time(s)\n";
}
if (keys %BackupStarted and $Detail) {
foreach my $Database (keys %BackupStarted) {
print "\nBackup started for $Database: $BackupStarted{$Database} Time(s)\n";
}
}
if (keys %BackupFile and $Detail >= 7) {
print "\nBacked up files:\n";
foreach my $File (sort {$a cmp $b} keys %BackupFile) {
print " $File: $BackupFile{$File} Time(s)\n";
}
}
if ($BackupCompleted and $Detail) {
print "\nBackup completed: $BackupCompleted Time(s)\n";
}
if (keys %Export and $Detail) {
print "\nExports:\n";
foreach my $Line (keys %Export) {
print " $Line $Export{$Line} Time(s)\n";
}
}
if (keys %Info and $Detail >= 7) {
print "\nInformational Messages::\n";
foreach my $Line (keys %Info) {
print " $Line $Info{$Line} Time(s)\n";
}
}
if (keys %SSLInit and $Detail >= 7) {
print "\nSSL Initialization:\n";
foreach my $Message (sort {$a cmp $b} keys %SSLInit) {
print " $Message\n";
}
}
if (keys %NSSCiphers and $Detail >= 7) {
print "\nNSS Cipers:\n";
foreach my $Cipher (sort {$a cmp $b} keys %NSSCiphers) {
print " $Cipher: $NSSCiphers{$Cipher}\n";
}
}
if (keys %OtherList) {
print "\n**Unmatched Entries**\n";
foreach my $line (sort {$a cmp $b} keys %OtherList) {
print " $line: $OtherList{$line} Time(s)\n";
}
}
|