dnsblcount

Count RBL Rejections in Postix Log


dnsblcount is a perl script that checks your Postfix mail log for for RBL rejections. It produces a report tallying rejections per RBL.

Tested on:

How It Works

All RBL rejections, such as those specified with reject_rbl_client, appear in the log with the string "blocked using". dnsblcount scans the selected maillog(s) for these rejections and compiles a report. The output will look something like this:

bl.example.net              1089
sbl.example.org              804
dul.example.com              408
dsbl.example.net              31
=================================
Total DNSBL rejections:     2332

Installation

To use dnsblcount, simply install it somewhere in root's path, such as /usr/local/sbin. Be sure to make it executable:

chmod +x /usr/local/sbin/dnsblcount 

If necessary, edit the first line of dnsblcount to include the path to the perl binary on your system.

Usage

dnsblcount can accept log lines from standard input, or the log(s) to parse may be specified on the command line. This can be a list separated by spaces and can contain wildcards. The following will all work:

dnsblcount /var/log/maillog
dnsblcount /var/log/maillog /var/log/maillog.1 
dnsblcount /var/log/maillog*
egrep 'bob@example.com' /var/log/maillog | dnsblcount 

Caveats

I've attempted to keep dnsblcount compatible with all versions of Postfix since 1.1.x. I usually run a recent snapshot on at least one server, but if you find that dnsblcount is not parsing the log correctly for your version, please send me a sample log entry showing an RBL rejection, and I will try to update the script.

The script hasn't been tested on enormous logs that might be common in large ISPs. Please let me know if you run into any problems with large logs.

Download

Source Documentation

Postfix - Postfix is a well-written MTA that attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users. As a result, email administrators that use Postfix sleep well at night and spend more time with their kids.


Home | Code | Services | Contact