Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tech:linux:postfix_report [2014/12/04 06:45]
tech:linux:postfix_report [2014/12/04 06:45] (current)
Line 1: Line 1:
 +====== Setting up daily mail reporting using pflogsumm ======
 +[[http://​jimsun.linxnet.com/​postfix_contrib.html|pflogsumm]] is a perl script used for postfix mail reporting.
 +
 +===== Setup =====
 +  * Create directory ''/​var/​log/​postfixrep''​
 +  * Copy ''​pflogsumm''​ into directory /​usr/​local/​bin/​pflogsumm
 +  * Create file /​etc/​cron.daily as below - change hard-coded email
 +
 +<code bash>
 +#!/bin/bash
 +#
 +# Daily Postfix Log report
 +#
 +TS=$(date +%Y%m%d_%H%M%S);​
 +LOGFILEDIR="/​var/​log/​postfixrep"​
 +LOGFILE="​$LOGFILEDIR/​pfrep_$TS.txt"​
 +PFLOGSUMM="/​usr/​local/​bin/​pflogsumm"​
 +PFMAILINF="/​var/​log/​mail.info"​
 +PFMAILINF="/​var/​log/​mail.log"​
 +REMAIL="​admin@example.org"​
 +REPSUB="​Postfix Report"​
 +#
 +$PFLOGSUMM $PFMAILINF > $LOGFILE
 +cat $LOGFILE | mailx -s "​$REPSUB"​ $REMAIL
 +#
 +/​usr/​bin/​find $LOGFILEDIR/​pfrep* -mtime +400 -exec rm {} \;
 +#
 +exit 0
 +</​code>​
  

QR Code
QR Code tech:linux:postfix_report (generated for current page)