Flexion.Org
Bad grammar and typos for total strangers
Wiki › Monitoring Postfix
Wiki Index All Recent Edit Bottom

Mailgraph

 apt-get install mailgraph

The stats are now available from...

Queue Graph

 apt-get install queuegraph

The stats are now available from...

Postfix Log and RBL Summaries

Although there is a Debian package for pflogsumm it is out of date, so I prefer to install that latest version manually. I also use a number of other analysis scripts to see and compre the effectiveness of the RBLs I query and get more detailed reports of what Postfix filters triggered.

 apt-get install libdate-calc-perl libfile-mmagic-perl
 wget http://jimsun.linxnet.com/downloads/pflogsumm-1.1.1.tar.gz
 tar zxvf pflogsumm-1.1.1.tar.gz
 cp pflogsumm-1.1.1/pflogsumm.pl /usr/local/bin/
 cp pflogsumm-1.1.1/pflogsumm.1 /usr/local/man/man1/
 wget http://www.joreybump.com/code/dnsblcount/dnsblcount -O /usr/local/bin/dnsblcount.pl
 wget http://taz.net.au/postfix/scripts/openlogfile.pl -O /usr/local/bin/openlogfile.pl
 wget http://taz.net.au/postfix/scripts/compare-rbls.pl -O /usr/local/bin/compare-rbls.pl
 chmod 755 /usr/local/bin/*.pl

Edit the 'compare-rbls.pl' script and add the list of RBL your currently query to the '@dnsrbls' array. You can also include any RBLs you are considering adding to Postfix to see how effective they might be in production.

 vi /usr/local/bin/compare-rbls.pl

 my @dnsrbls = qw(sbl-xbl.spamhaus.org
                  dnsbl.njabl.org
                  bl.spamcop.net
                  list.dsbl.org
                  safe.dnsbl.sorbs.net
                  ubl.unsubscore.com
                  psbl.surriel.com
                  rhsbl.sorbs.net
                 );

Now create a logrotate script to rotate the mail logs each day and generate the reports...

 vi /etc/logrotate.d/mail

 /var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn {
     missingok
     daily
     rotate 7
     create 640 root adm
     delaycompress
     start 0
     sharedscripts
     postrotate
          mkdir -p /var/www/reports/${HOSTNAME}/`date +%Y`/`date +%m`/`date +%d`
          pflogsumm.pl -d yesterday /var/log/mail.log.0 | tee /var/www/reports/${HOSTNAME}/`date +%Y`/`date +%m`/`date +%d`/Postfix\ Log\ Summary.txt | mail -s "Postfix Log Summary" root@example.org
          dnsblcount.pl /var/log/mail.log.0 | tee /var/www/reports/${HOSTNAME}/`date +%Y`/`date +%m`/`date +%d`/Postfix\ RBL\ Summary.txt | mail -s "Postfix RBL Summary" root@example.org
          chmod 644 /var/www/reports/${HOSTNAME}/`date +%Y`/`date +%m`/`date +%d`/*
         chown www-data:www-data /var/www/reports/${HOSTNAME}/`date +%Y`/`date +%m`/`date +%d`/*
     endscript	
 }

References

$Id: MonitoringPostfix,v 1.11 2008/01/06 09:38:43 martin Exp $

Wiki Index All Recent Edit Top
 
Valid XHTML Valid CSS Hacker