1 ###########################################################################
2 # ipblocklist script for Logwatch
3 # Analyzes the IPFire IP Blocklist log
5 #########################################################################
7 ########################################################
8 ## Copyright (c) 2008 Lars Skjærlund
9 ## Covered under the included MIT/X-Consortium License:
10 ## http://www.opensource.org/licenses/mit-license.php
11 ## All modifications and contributions by other persons to
12 ## this script are assumed to have been donated to the
13 ## Logwatch project and thus assume the above copyright
14 ## and licensing terms. If you want to make contributions
15 ## under your own copyright or a different license this
16 ## must be explicitly stated in the contribution and the
17 ## Logwatch project reserves the right to not accept such
18 ## contributions. If you have made significant
19 ## contributions to this script and want to claim
20 ## copyright please contact logwatch-devel@lists.sourceforge.net.
21 #########################################################
23 #########################################################################
24 # Files - all shown with default paths:
26 # /usr/share/logwatch/default.conf/logfiles/messages.conf
27 # /usr/share/logwatch/dist.conf/services/blocklist.conf
28 # /usr/share/logwatch/scripts/services/ipblocklist (this file)
33 #########################################################################
35 use Logwatch ':dates';
37 my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};
44 $SearchDate = TimeFilter("%b %e");
46 while (defined(my $ThisLine = <STDIN>))
48 next unless ($ThisLine =~ m/^\s*\w+\s+\w+\s+(..:..:..) .* ipblocklist: (.*)/);
52 if ($text =~ m/Successfully updated (\w+) blocklist/)
54 $Updates{$1}{updates}++;
56 elsif ($text !~ m/Skipping (\w+) blocklist - Too frequent update attempts!/ and
57 $text !~ m/Skipping (\w+) blocklist - It has not been modified!/ )
63 #####################################################################
67 print "\nThe following block lists were updated:\n";
68 foreach my $Lists (sort keys %Updates)
70 print " $Lists: $Updates{$Lists}{updates} Time(s)\n";
76 print "\nThe following errors were detected:\n";
78 foreach my $Text (keys %Errors)
80 print " $Text: $Errors{$Text} Time(s)\n";
86 # vi: shiftwidth=3 tabstop=3 syntax=perl et
89 # perl-indent-level: 3
90 # indent-tabs-mode: nil