[CentOS] sendmail and rbl blocking - generating statistics

Wed Mar 14 20:08:06 UTC 2007
Will McDonald <wmcdonald at gmail.com>

On 14/03/07, Ryan Simpkins <centos at ryansimpkins.com> wrote:
> Mar 14 09:31:36 io sendmail[19416]: ruleset=check_relay, arg1=[],
> arg2=, relay=[], reject=554 5.7.1 Rejected found in
> bl.spamcop.net
> Try doing a simple 'cat /var/log/maillog | grep -c check_relay'

You can avoid the unnecessary 'cat' by just passing the filename to
grep directly:

# grep -c check_relay /var/log/maillog

This *should* be quicker, especially in looping constructs.

> For my server:
> cat /var/log/maillog | grep checK_relay | grep -c spamhaus
> 836


# grep -c 'checK_relay.*spamhaus' /var/log/maillog
# grep -c 'checK_relay.*spamcop' /var/log/maillog
# grep -c 'checK_relay.*njabl' /var/log/maillog

Would probably be more efficient and faster, you can test with 'time'
to verify this. You're spawning one process 'grep', instead of three
seperate processes, 'cat, 'grep' and 'grep' again.