Using Pflogsumm Postfix Log Analyzer
Pflogsumm is an oldie but a goodie. It’s a Perl script that sifts through your Postfix server maillog and provides you with a neat summary of events and some statistics. This information can be useful in detecting sudden changes in your normal mail flow. Here’s how to install pflogsumm on CentOS/RHEL:
First, some prerequisites for Perl:
yum install perl-Date-Calc
Now pflogsumm itself:
mkdir -p /usr/local cd /usr/local/ curl -O http://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz tar -xzf pflogsumm-1.1.3.tar.gz /bin/mv pflogsumm-1.1.3 pflogsumm chmod +x pflogsumm/pflogsumm.pl
A sample run:
perl /usr/local/pflogsumm/pflogsumm.pl /var/log/maillog
A more practical example using cron to email you daily stats of your Postfix server activities:
0 0 * * * perl /usr/local/pflogsumm/pflogsumm.pl /var/log/maillog | mailx -s "`hostname` Postfix Summary for `date +'%Y-%m-%d'`" you@yourdomain.com >/dev/null 2>&1