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?

link|improve this question

feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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