Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

acquire Postfix statistics

241 views
Skip to first unread message

Zhou, Yan

unread,
Apr 12, 2011, 11:34:00 AM4/12/11
to
Hi There,

How do you gather statistics for messages delivered and processed via
Postfix (both inbound and outbound)? For instance, to show on a daily
basis, how many messages we have received from each domain, how many
messages we have delivered to each domain, etc.

I have seen some options relying on passing the maillog file, I wonder
if there is any other option?

Thanks,
Yan

Confidentiality Notice: The information contained in this electronic transmission is confidential and may be legally privileged. It is intended only for the addressee(s) named above. If you are not an intended recipient, be aware that any disclosure, copying, distribution or use of the information contained in this transmission is prohibited and may be unlawful. If you have received this transmission in error, please notify us by telephone (513) 229-5500 or by email (postm...@MedPlus.com). After replying, please erase it from your computer system.

Randy Ramsdell

unread,
Apr 12, 2011, 11:56:44 AM4/12/11
to

You have to write script or download something.


external : grep on "relay=" and sent excluding local domains.
internal : grep on "relay=local" or where ever the mail store is.

cut, sort and uniq work well for this in Bash.

Zoltan Balogh

unread,
Apr 15, 2011, 8:08:30 AM4/15/11
to
2011/4/12 Zhou, Yan <yz...@medplus.com>

How do you gather statistics for messages delivered and processed via
Postfix (both inbound and outbound)? For instance, to show on a daily
basis, how many messages we have received from each domain, how many
messages we have delivered to each domain, etc.

I have seen some options relying on passing the maillog file, I wonder
if there is any other option?

pflogsumm parses mail logs and does a great job - http://jimsun.linxnet.com/postfix_contrib.html
You can run it regularly by cron - http://zee.balogh.sk/?p=2488
Why would you want to do it another way?

Z.


James Seymour

unread,
Apr 15, 2011, 9:06:17 AM4/15/11
to
Replying to Yan via a follow-up to Zoltan, as I didn't see Yan's
original question...

On Fri, 15 Apr 2011 14:08:30 +0200
Zoltan Balogh <zee.b...@gmail.com> wrote:

> 2011/4/12 Zhou, Yan <yz...@medplus.com>
>
[snip]


> > I have seen some options relying on passing the maillog file, I
> > wonder if there is any other option?
> >

[snip]

I'm curious: How might one gather and process mail server statistics
*other* than parsing and processing the mail server's log file(s)?

Regards,
Jim
--
Note: My mail server employs *very* aggressive anti-spam
filtering. If you reply to this email and your email is
rejected, please accept my apologies and let me know via my
web form at <http://jimsun.LinxNet.com/contact/scform.php>.

Ralf Hildebrandt

unread,
Apr 15, 2011, 9:17:06 AM4/15/11
to
* James Seymour <jsey...@LinxNet.com>:

> I'm curious: How might one gather and process mail server statistics
> *other* than parsing and processing the mail server's log file(s)?

The server could be gathering stats (snmp style) in a "stats" daemon
(which is, like qmgr, long running). Upon stop it would write
statistics to a database file (or into a real database) and would
reload the counters from the upon restart.


--
Ralf Hildebrandt
Geschäftsbereich IT | Abteilung Netzwerk
Charité - Universitätsmedizin Berlin
Campus Benjamin Franklin
Hindenburgdamm 30 | D-12203 Berlin
Tel. +49 30 450 570 155 | Fax: +49 30 450 570 962
ralf.hil...@charite.de | http://www.charite.de

James Seymour

unread,
Apr 15, 2011, 9:42:40 AM4/15/11
to
On Fri, 15 Apr 2011 15:15:50 +0200
Patrick Ben Koetter <p...@state-of-mind.de> wrote:

>
>
> Am 15.04.2011 15:06, schrieb James Seymour:
> > I'm curious: How might one gather and process mail server statistics
> > *other* than parsing and processing the mail server's log file(s)?
>

> Query amavis snmp agent. It keeps track of Postfix queue status if it
> finds Postfix queues.

Would that provide the information the OP was seeking?

James Seymour

unread,
Apr 15, 2011, 9:47:25 AM4/15/11
to
On Fri, 15 Apr 2011 15:17:06 +0200
Ralf Hildebrandt <Ralf.Hil...@charite.de> wrote:

> * James Seymour <jsey...@LinxNet.com>:


>
> > I'm curious: How might one gather and process mail server statistics
> > *other* than parsing and processing the mail server's log file(s)?
>

> The server could be gathering stats (snmp style) in a "stats"

> daemon ...
[snip]

Could be, but isn't. Besides which: If the stats were comprehensive,
just imagine the memory usage. Or it'd have to stash them in some kind
of database store all along, which might have performance implications,
might it not?

Serious questions/concerns. Not trying to be argumentative.

Ralf Hildebrandt

unread,
Apr 15, 2011, 10:07:10 AM4/15/11
to
* James Seymour <jsey...@LinxNet.com>:

> On Fri, 15 Apr 2011 15:17:06 +0200
> Ralf Hildebrandt <Ralf.Hil...@charite.de> wrote:
>
> > * James Seymour <jsey...@LinxNet.com>:
> >
> > > I'm curious: How might one gather and process mail server statistics
> > > *other* than parsing and processing the mail server's log file(s)?
> >
> > The server could be gathering stats (snmp style) in a "stats"
> > daemon ...
> [snip]
>
> Could be, but isn't. Besides which: If the stats were comprehensive,
> just imagine the memory usage. Or it'd have to stash them in some kind
> of database store all along, which might have performance implications,
> might it not?

Well, like anvil right now, or more like postscreen, which also stores
a metric assload of data.

Jeroen Geilman

unread,
Apr 15, 2011, 3:55:32 PM4/15/11
to
On 04/12/2011 05:34 PM, Zhou, Yan wrote:
> Hi There,
>
> How do you gather statistics for messages delivered and processed via
> Postfix (both inbound and outbound)?

Use pflogsumm.pl - it's a standard of sorts.

http://linxnet.com/postfix_contrib.html

> For instance, to show on a daily
> basis, how many messages we have received from each domain, how many
> messages we have delivered to each domain, etc.
>

I use awstats for that:

http://awstats.sourceforge.net/

You'll have to twiddle for a few hours to get it to do email, but it is
actually supported out of the box.

> I have seen some options relying on passing the maillog file, I wonder
> if there is any other option?
>

No.
You'll have to consider WHY you want these statistics - then focus on
getting exactly the data you require.

Nothing prevents you from sending all mail through a custom milter or
policy service that merely counts messages, after all.


--
J.

0 new messages