On Wed, 2013-01-30 at 14:23:19 -0500, Mike. wrote: > I made some changes to the script based upon the excellent feedback I > received here. > > The script no longer wanders beyond the postscreen log records in > order to gather the information needed to determine the postscreen > rejection rate. So that removes the problems caused by > multiple-recipient messages. > ...
Be careful with grep(1) patterns. You overstate CONNECTs by including 'NOQUEUE: reject: CONNECT' in the count. Meanwhile, the script understates total DNSBL rejections, which you measure with: | grep -c "DNSBL rank [3-99]" That bracket expression matches on a _single_ character, and does not capture double-digit ranks. A similar mistake occurs in the attempt to aggregate 9+ ranks: | grep -c "DNSBL rank [9-99] " This only counts appearances of "DNSBL rank 9" in the log, as illustrated below: | % grep -c "DNSBL rank [9-99] " maillog | 4494 | % grep -c "DNSBL rank 9 " maillog | 4494 Review the re_format(7) and grep(1) manuals to improve understanding of regular expressions. In case it helps you, last year I had cobbled together a slower (it is Python rather than a set of grep(1) expressions) script[1] to collect similar statistics. No promises that it is error-free. [1] http://people.freebsd.org/~sahil/scripts/mailstats.py.txt -- Sahil Tandon