The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 SpamAssassin hits range - script
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#



Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org