If you have php installed, cut and paste this into a file.
You'll have to do a bit of tailoring to your spamassassin call scripts 
to get it to use one file, or the php script to read many files, but
it will give you a total breakdown of what has come into your mailserver and
how spamassassin handled it. 
-----
<?php
$file='/var/MailRoot/logs/spam.log';  //your spam log
$fp=fopen('/var/MailRoot/logs/spam.log', 'r');
$spam=0;
$notspam=0;
$unknown=0;
$total=0;
while(!FEOF($fp))
        {
        $line= fgets($fp, 4096);
        $line= preg_replace('/\"/', '', $line);
        $array= explode("\t", $line);
        $user=strtolower(substr($array[2],0,(strpos($array[2],"@"))));

        if ($array[1]=='SPAM')
                {
                $spam++;
                if (
                        //start of hidden recipients
                        ($user != 'postmaster')&&
                        ($user != 'webmaster')&&
                        ($user != 'admin')
                        //omits defined mail users
                )
                {
                $users[$user]++;
                }
                }
        if ($array[1]=='NOT SPAM')
                {
                $notspam++;
                }
        else { $unknown++;} //unknown are too large to scan, most likely               
 
//notspam
       }
        $total=$spam+$notspam+$unknown;
        arsort($users);

        printf ('SPAM: %d out of %d (%.2f percent)', $spam, $total, 
(($spam/$total)*100));
        echo "\n";
        printf ('NOT SPAM: %d out of %d (%.2f percent)', $notspam, $total, 
(($notspam/$total)*100));
                echo "\n";
        printf ('UNDETERMINED: %d out of %d (%.2f percent)', $unknown, $total, 
(($unknown/$total)*100));
                echo "\n";
        printf ("\n\nUSER SUMMARY\n\n");
        foreach ($users as $key => $value) {
        $percent=(((int)$value  / (int)$spam)*100);
        printf ("%s has received %d spam messages (%.2f percent)\n", $key, 
$value, $percent );
        }

?>

--
Someone with more Perl experience might want to convert it.
YMMV.

On July 22, 2003 07:20 am, you wrote:
> Hi there,
>
> Your stats make a lot of sense.
> Thank you very much for your reply,
>
> spyros
>
-- 

-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]

Reply via email to