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.

Our company has a server (VPS) which runs qmail. I have a number of IMAP mailboxes under our domain on this server and I want to find out how many emails are sent from our domain over a certain period (i.e. one month). Is there any way of doing this?

share|improve this question

2 Answers 2

I would go for grep -c "delivery [0-9]*: success" /path/to/your/logfile.log.

This will work fine on its own if your log files are rotated monthly. You may need to include more log files if they are rotated daily and if they don't match any time-based schedule then you may have to grep for the month as well.

The first likely trouble is that qmail likes to rotate its own log files and by default (from memory) does this when they reach 10MB and keeps 4 of them. You will have to change your logging configuration either to tell qmail to keep more of them or to pipe them all through syslog and have syslog manage them.

The second is that timestamps in qmail are not human readable. Make sure you pipe everything through tai64nlocal so you can read the timestamps.

Log files generated by qmail are different to other log files. You will want some help dealing with them.

If you spend any time with qmail, you will want to know about Life With qmail and The DJB way.

share|improve this answer

There are some ready made tools for log analysis for Qmail.

You can use qmailanalog by djb himself but take care with what Ladadadada said about Qmail's log rotation.

There are 2 other tools that are a bit more analytical:

  1. Isolog that creates graphs that you can drill down and see your stats
  2. Qmailmrtg that creates the usual mrtg output and you can manipulate that to your needs.
share|improve this answer

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.