Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

Your Answer


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.