habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

PFlogsumm – Daily Report Postfix Monitoring on CentOS 6

1 min read

PFlogsumm-Daily-Report-Postfix-Monitoring-on-CentOS

Pflogsumm is a simple Perl script that monitors your Postfix mail server’s activity. This guide will show you how to install PFlogsumm – Daily Report Postfix on CentOS 6 and configure it to send you a daily email with your mail server stats.

Prerequisites PFlogsumm – Daily Report Postfix

At first, Make sure these prerequisites are installed:

  • Postfix
  • Perl 5.004
  • Perl’s Date::Calc module

Perl 5.004 will most likely be installed by default. Run this command to install the Date::Calc module:

sudo yum install perl-Date-Cal

Finally, you will need to locate your Postfix log. On most CentOS systems, this is /var/log/maillog by default.

Get pflogsumm setup and running

  1. Step 1: To get started you first need to download the pflogsumm.pl perl script. Download pflogsumm.pl here.
  2. Step 2: Extract the files from the tar ball and put _only_ the perl script pflogsumm.pl into /usr/local/bin/ . Make sure the permissions are 700 for security.
[root@dnscache01 bin]# pwd
/usr/local/bin
[root@dnscache01 bin]# ls -l
total 56
-rwx------ 1 root root 53740 Mar 6 16:49 pflogsumm
  1. Step 3: Setup a cron job to mail out the report every day at 11:59pm (23:59).
30 23  *   *   *        /usr/local/bin/pflogsumm /var/log/maillog | mail -s "`hostname -f` Postfix Mail Statistics `date`" [email protected]

This is the same line used to generate the example email shown in the scrollable table above. The cron job is going to go through the postfix log in /var/log/maillog and report todays stats from 12:00am to 11:59pm. We are going the see the top five(5) senders and receivers of email by volume and size. The report is going to be mailed to root with the subject like “pflogsumm report Mon Jan 1 11:00:00 EDT 2007”.

See also  Alma Linux 8 - Postfix SMTP Server

Setup Cron Job to Run Daily

I would suggest running the cron job line at least once to make sure everything works. If you do not get any errors and the email comes through then you are done. If you experience problems, then take a look at the question and answer section at the bottom of this page.

habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss good article from us, get weekly updates in your inbox