Postfix mail statistics

Simple statistic every day
I tested on CentOS 7. Install pflogsumm that is Postfix mail log reporting tool. We run:
sudo yum install postfix-perl-scripts

Testing:
perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog
Now we create the script /usr/local/sbin/postfix_report.sh which invokes pflogsumm and makes it send the report to me:
nano /usr/local/sbin/postfix_report.sh

#!/bin/sh
pflogsumm /var/log/maillog | mail -s "Mail Statistics" [email protected]
exit 0

We must make this script executable:
chmod +x /usr/local/sbin/postfix_report.sh
Then we create a cron job which calls the script everyday at 05:00h: crontab -e
0 5 * * * /usr/local/sbin/postfix_report.sh &> /dev/null
OR short version:
# send mail log summary at AM 5:00 everyday to root
0 5 * * * perl /usr/sbin/pflogsumm -e -d yesterday /var/log/maillog | mail -s 'Logwatch for Postfix' [email protected]
Options:
-d today generate report for just today
-d yesterday generate report for just “yesterday”
-e extended
More options here.
Done!