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

I'm trying to set up a relay server using Postfix as MTA, and I need to log the server's mail usage (either to file or SQL). The idea is to monitor the amount of mails sent by host, and their size.

I've looked at several possibilities for this kind of traffic accounting in Postfix. They can be summed up as:

  • A daemon running to intercept port 25 traffic, log it, then send the request to Postfix
  • Log file analyzers that determine # mails sent & mail size via the /var/log/maillog (written in python, C-code, ...)

Analyzing log files will cause bounced mails being resent to count as doubles, while the daemon that's intercepting incoming port 25 won't notice Postfix re-running it's onhold-queue. So there's bound to be differences in both way of 'traffic accounting'.

Some examples include:

But none seem to be able to give very detailed information. I prefer to log as much as possible (requesting IP, mailsize, from, to, mail-id, receiving mta, ...).

Do you have any experience with it? Are there recommendations, or things to look out for?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Use a policy daemon http://www.postfix.org/SMTPD_POLICY_README.html a good one that does accounting is policyd http://www.policyd.org/

It will log all the information you require to a database.

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.