On 14/03/07, Ryan Simpkins centos@ryansimpkins.com wrote:
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'
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
Again:
# 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.
Will.