Simple threaded stats aggregator for Postfix
Clone or download
tail Merge pull request #5 from tsheasha/master
Move lock to handle funciton call.
Latest commit d58f792 Dec 30, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Add .gitignore May 21, 2012
LICENSE Initial commit Dec 23, 2011
README.rst Update readme with tail command May 23, 2012 Parsing is thread safe it is just the handling that is an issue Dec 30, 2015 0.3.2 Feb 11, 2015


Simple threaded stats aggregator for Postfix. When running as a syslog destination, it can be used to get realtime cumulative stats.


Usage: [options] file1 file2 ... fileN

-d, --daemon Run tcp server for getting stats from
-p PORT, --port=PORT
 Port to listen on for grabbing stats (Default: 7777)
-i HOST, --host=HOST
 Host/IP to listen on for grabbing stats (Default:
-c NUM, --concurrency=NUM
 Number of threads to spawn for handling lines (Default: 2)
 Search for STRING in incoming email addresses and incr stat NAME and if COUNT, count in incoming stats - STRING,NAME,COUNT

Daemon Mode

Primary use is as a syslog destination


destination df_postfix_stats { program("/usr/bin/python /usr/bin/ -d -c 4 -"); };
filter f_postfix { program("^postfix/"); };
log {


mail.*  |/usr/bin/python /usr/bin/ -d -c 4 -


Create that calls with the arguments you wish to use

$ModLoad omprog
$actionomprogbinary /usr/bin/
:syslogtag, startswith, "postfix" :omprog:;RSYSLOG_TraditionalFileFormat


If you don't want to wire it up to syslog but need current stats use this.

tail -qf /var/log/mail.* | /usr/bin/ -d

To grab the current cumulative stats as a json dump

echo stats | nc 7777

Or human readable

echo prettystats | nc 7777

File Mode

Pass it a list of log files or stdin and it will aggregate them and dump a json dictionary -c 12 -l,notifications,true postfix.log postfix.log.1 postfix.log.2