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.

From postfix's logfile I can grep all the lines that indicate the delivery of one message:

Jan  3 15:28:21 mail postfix/pipe[1040]: [...] status=sent
Jan  3 15:28:21 mail postfix/pipe[1157]: [...] status=sent
Jan  3 15:28:22 mail postfix/pipe[980]: [...] status=sent

I'd like to group them together by timestamp, so I can calculate the messages per second for a given time range. How can I do that?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

This should do it:

$ cut -d " " -f 4 postfix.log  | sort -n | uniq -c

If you want to select a given time range, just throw another grep before this with your desired regex.

share|improve this answer
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.