[CentOS] sendmail and rbl blocking - generating statistics
centos at ryansimpkins.com
Wed Mar 14 20:35:09 UTC 2007
On Wed, March 14, 2007 14:08, Will McDonald wrote (trimmed):
> On 14/03/07, Ryan Simpkins <centos at ryansimpkins.com> wrote:
>> 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.*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.
Am I using time right to measure it?
# time cat /var/log/maillog | grep check_relay | grep -c njabl
# time grep -c 'check_relay.*njabl' /var/log/maillog
Is the first 'time' measuring the whole one-liner, or just the time it takes to 'cat'?
I also tried this:
time echo `cat /var/log/maillog | grep check_relay | grep -c njabl` 8
time echo `grep -c 'check_relay.*njabl' /var/log/maillog`
I ran these several times mixed back and forth to try and see if they were flukes,
these numbers appear to be representitive of the average. What do you get on your
system? Maybe passing the file name to grep gets faster as the file size increases?
12323 142894 1588860 /var/log/maillog
I wonder if the issue here is actually the 'stuff*morestuff' as that might be a more
time echo `grep -c 'check_relay' /var/log/maillog | grep njabl`
More information about the CentOS