[CentOS] sendmail and rbl blocking - generating statistics

Wed Mar 14 16:56:47 UTC 2007
Ryan Simpkins <centos at ryansimpkins.com>

On Wed, March 14, 2007 01:38, Erick Perez wrote:
> I have enabled the feature in sendmail.mc to check with spamhaus for
> spammers. However since this block is being made at MTA level, I would
> like to know is something can be done to obtain statistics of blocked
> attemps.

I do this by parsing the logs:

Mar 14 09:31:36 io sendmail[19416]: ruleset=check_relay, arg1=[84.4.97.105],
arg2=127.0.0.2, relay=[84.4.97.105], reject=554 5.7.1 Rejected 84.4.97.105 found in
bl.spamcop.net

Try doing a simple 'cat /var/log/maillog | grep -c check_relay'

For my server:

cat /var/log/maillog | grep checK_relay | grep -c spamhaus
836

cat /var/log/maillog | grep checK_relay | grep -c spamcop
120

cat /var/log/maillog | grep checK_relay | grep -c njabl
8

You could write a simple script to give you more details, like highest hit days. I'm
*sure* there are log analyzers out there that do this. I've also seen a few people
who have written script and stuffed the numbers in to RRDTool to visualize the RBLs.

-Ryan