Author: Erin
Date: 06-08-04 16:43
I wanted to see the range of SpamAssassin hits after seeing a poll on slashdot.org. Simple stuff, maybe one day I will build a graph or something for it.
--------------------------------
#!/usr/bin/perl -w
use strict;
my @DATA;
my $i = 0;
my $low = 0;
my $high = 0;
open(DATA, "/var/log/maillog") or die"Unable to open log file: $!";
while(<DATA>) {
if ( /Hits\:\s+(\-?[0-9]{1,2}\.[0-9]{1,3})/ ) {
if ($1 > $high) {
$high = $1;
} elsif ($1 < $low) {
$low = $1;
};
$i++;
};
};
close(DATA);
print "Total: $i\n";
print "Lowest: $low\n";
print "Highest: $high\n";
exit(1);
--------------------------------
Sample output...
--------------------------------
root@vhost# ./hits.pl
Total: 69009
Lowest: -22.663
Highest: 52.355
root@vhost#
|
|