1 |
diff -ruN smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats.cron smeserver-mailstats-1.1/root/etc/cron.d/mailstats.cron |
2 |
--- smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats.cron 2012-05-26 17:09:22.000000000 +0200 |
3 |
+++ smeserver-mailstats-1.1/root/etc/cron.d/mailstats.cron 2015-06-11 00:38:15.000000000 +0200 |
4 |
@@ -1,2 +1,2 @@ |
5 |
-0 0 * * * root perl /usr/bin/spamfilter-stats-7.pl /var/log/qpsmtpd/\@* /var/log/qpsmtpd/current |
6 |
+0 0 * * * root sleep $[ $RANDOM \% 3600 ]; perl /usr/bin/spamfilter-stats-7.pl /var/log/qpsmtpd/\@* /var/log/qpsmtpd/current /var/log/sqpsmtpd/\@* /var/log/sqpsmtpd/current |
7 |
|
8 |
diff -ruN smeserver-mailstats-1.1.old/root/usr/bin/spamfilter-stats-7.pl smeserver-mailstats-1.1/root/usr/bin/spamfilter-stats-7.pl |
9 |
--- smeserver-mailstats-1.1.old/root/usr/bin/spamfilter-stats-7.pl 2014-06-16 17:56:40.000000000 +0200 |
10 |
+++ smeserver-mailstats-1.1/root/usr/bin/spamfilter-stats-7.pl 2015-06-11 00:38:15.000000000 +0200 |
11 |
@@ -1,3 +1,5 @@ |
12 |
+ |
13 |
+ |
14 |
#!/usr/bin/perl -w |
15 |
|
16 |
############################################################################# |
17 |
@@ -9,6 +11,10 @@ |
18 |
# and re-written by brian read at bjsystems.co.uk (with some help from the community - thanks guys) |
19 |
# |
20 |
# bjr - 02sept12 - Add in qpsmtpd failure code auth::auth_cvm_unix_local as per Bug 7089 |
21 |
+# bjr - 10Jun15 - Sort out multiple files as input parameters as per bug 5613 |
22 |
+# - Sort out geoip failure status as per Bug 4262 |
23 |
+# - change final message about the DB (it is created automatically these days by the rpm) |
24 |
+# |
25 |
# |
26 |
############################################################################# |
27 |
# |
28 |
@@ -61,7 +67,7 @@ |
29 |
|
30 |
#Configuration section |
31 |
my %opt = ( |
32 |
- version => '0.6.26', # please update at each change. |
33 |
+ version => '0.6.27', # please update at each change. |
34 |
debug => 0, # guess what ? |
35 |
sendmail => '/usr/sbin/sendmail', # Path to sendmail stub |
36 |
from => 'spamfilter-stats', # Who is the mail from |
37 |
@@ -130,12 +136,13 @@ |
38 |
my $CATRBLDNS='RBL/DNS'; |
39 |
my $CATEXECUT='Execut.'; |
40 |
my $CATNONCONF='Non.Conf.'; |
41 |
+my $CATBADCOUNTRIES='Geoip.'; |
42 |
my $CATSPAMDEL='Del.Spam'; |
43 |
my $CATSPAM='Qued.Spam?'; |
44 |
my $CATHAM='Ham'; |
45 |
my $CATTOTALS='TOTALS'; |
46 |
my $CATPERCENT='PERCENT'; |
47 |
-my @categs = ($CATHOUR,$CATFETCHMAIL,$CATWEBMAIL,$CATMAILMAN,$CATLOCAL,$CATVIRUS,$CATRBLDNS,$CATEXECUT,$CATNONCONF,$CATSPAMDEL,$CATSPAM,$CATHAM,$CATTOTALS,$CATPERCENT); |
48 |
+my @categs = ($CATHOUR,$CATFETCHMAIL,$CATWEBMAIL,$CATMAILMAN,$CATLOCAL,$CATVIRUS,$CATRBLDNS,$CATEXECUT,$CATBADCOUNTRIES,$CATNONCONF,$CATSPAMDEL,$CATSPAM,$CATHAM,$CATTOTALS,$CATPERCENT); |
49 |
my $GRANDTOTAL = '99'; #subs for count arrays, for grand total |
50 |
my $PERCENT = '98'; # for column percentages |
51 |
|
52 |
@@ -270,16 +277,18 @@ |
53 |
my @ARGV2; |
54 |
foreach ( map { glob } @ARGV){ |
55 |
push(@ARGV2,($_)); |
56 |
+#print "\nFound $_"; |
57 |
} |
58 |
@ARGV=@ARGV2; |
59 |
|
60 |
LINE: while (<>) { |
61 |
+#print "\nLine:$_"; |
62 |
my($tai,$log) = split(' ',$_,2); |
63 |
|
64 |
|
65 |
#If date specified, only process lines matching date |
66 |
next LINE if ( $tai lt $starttai ); |
67 |
- last if ( $tai gt $endtai ); |
68 |
+ next LINE if ( $tai gt $endtai ); |
69 |
|
70 |
# pull out spamasassin rule lists |
71 |
if ( $_ =~m/spamassassin plugin: check_spam:.*hits=(.*), required.*tests=(.*)/ ) |
72 |
@@ -297,6 +306,8 @@ |
73 |
#only select Logterse output |
74 |
next LINE unless m/terse plugin/; |
75 |
|
76 |
+#print "\nFound $_"; |
77 |
+ |
78 |
|
79 |
my $abstime = Time::TAI64::tai2unix($tai); |
80 |
my $abshour = floor( $abstime / 3600 ); # Hours since the epoch |
81 |
@@ -454,6 +465,8 @@ |
82 |
|
83 |
if ($log_items[5] eq 'count_unrecognized_commands') {$MiscDenyCount++;$counts{$abshour}{$CATNONCONF}++;mark_domain_rejected($proc);next LINE} |
84 |
|
85 |
+ if ($log_items[5] eq 'check_badcountries') {$MiscDenyCount++;$counts{$abshour}{$CATBADCOUNTRIES}++;mark_domain_rejected($proc);next LINE} |
86 |
+ |
87 |
if ($log_items[5] eq 'tnef2mime') { next LINE} #Not expecting this one. |
88 |
|
89 |
if ($log_items[5] eq 'spamassassin') { $above15++;$counts{$abshour}{$CATSPAMDEL}++; |
90 |
@@ -851,7 +864,7 @@ |
91 |
if ($savedata) { save_data(); } |
92 |
else |
93 |
{ print "No data saved - if you want to save data to a MySQL database, then please use:\n". |
94 |
- "config setprop mailstats SaveDataToMySQL yes\nYou must have created the database first."; |
95 |
+ "config setprop mailstats SaveDataToMySQL yes\n"; |
96 |
} |
97 |
|
98 |
|
99 |
@@ -1320,3 +1333,5 @@ |
100 |
my $daterec = $sth->fetchrow_hashref(); |
101 |
$daterec->{"dateid"}; |
102 |
} |
103 |
+ |
104 |
+ |
105 |
|