Table of Contents

Setting up daily mail reporting using pflogsumm

pflogsumm is a perl script used for postfix mail reporting.

Setup

#!/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