Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Does anyone know of a utility of that would give me the total number of email messages sent by sendmail, using old maillogs ?

Someone suggested the use of the mailstats utility, however this program seems to give the statistical information for all mail log file entries. Though this is beneficial, it's not helpful on this case since a single mail message sent by sendmail can log anywhere to 5 different log entries.

share|improve this question
add comment

2 Answers

Does grep 'Message accepted for delivery' /var/log/maillog| wc -l provide the number you need?

share|improve this answer
    
Is the string 'Message accepted for delivery' the standard sendmail log entry for successful messages? If so then this is what I was looking for. -Tony –  Alpha01 Sep 20 '11 at 21:29
add comment

You can use grep -c to count the number of matching lines instead of pipe grep to wc -l:

grep -c "Message accepted for delivery" /var/log/maillog
share|improve this answer
    
Neat trick! It's much faster than piping! On a 2GB file it ran in 1/3 the time. –  Aaron Copley Jan 4 '12 at 0:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.