How to get mail statistics from your postfix mail logs

Overview :-

Last few years  i am supporting postfix mail servers. I would like to share one nice log diagnosing tool that I have used more ” Postfix Log Entry Summarizer

Its an amazing tool and will provide you the following details

  • Total number of:
    • Messages received, delivered, forwarded, deferred, bounced and rejected
    • Bytes in messages received and delivered
    • Sending and Recipient Hosts/Domains
    • Senders and Recipients
    • Optional SMTPD totals for number of connections, number of hosts/domains connecting, average connect time and total connect time
  • Per-Day Traffic Summary (for multi-day logs)
  • Per-Hour Traffic (daily average for multi-day logs)
  • Optional Per-Hour and Per-Day SMTPD connection summaries
  • Sorted in descending order:
    • Recipient Hosts/Domains by message count, including:
      • Number of messages sent to recipient host/domain
      • Number of bytes in messages
      • Number of defers
      • Average delivery delay
      • Maximum delivery delay
    • Sending Hosts/Domains by message and byte count
    • Optional Hosts/Domains SMTPD connection summary
    • Senders by message count
    • Recipients by message count
    • Senders by message size
    • Recipients by message size

    with an option to limit these reports to the top nn.

  • A Semi-Detailed Summary of:
    • Messages deferred
    • Messages bounced
    • Messages rejected
  • Summaries of warnings, fatal errors, and panics
  • Summary of master daemon messages

Installation :-

Installation is very simple , just download the package and unzip

  •  wget http://jimsun.linxnet.com/downloads/pflogsumm-1.1.1.tar.gz
  •  tar -zxf pflogsumm-1.1.1.tar.gz
  • chown root:root pflogsumm-1.1.1

 

Generate the statistics  :-

#  cat /var/log/maillog | ./pflogsumm.pl
( The above command will generate a detailed statistics as follows )

Grand Totals
————
messages

   1867   received
   3523   delivered
      0   forwarded
   707   deferred  (75  deferrals)
     35   bounced
    259  rejected (6%)
      0   reject warnings
      0   held
      0   discarded (0%)

  55528k  bytes received
  71732k  bytes delivered
     46   senders
     32   sending hosts/domains
    649   recipients
    350   recipient hosts/domains

Per-Day Traffic Summary
    date          received  delivered   deferred    bounced     rejected
    ——————————————————————–
    Jul 17 2011       257       2003       7295          8
    Jul 18 2011       471        352         94          2        216
    Jul 19 2011       986       1000        145         23         33
    Jul 20 2011       153        168         55          2         10

Per-Hour Traffic Daily Average
    time          received  delivered   deferred    bounced     rejected
    ——————————————————————–
    0000-0100           9          9          3          0          1
    0100-0200          11         10          4          1          4
    0200-0300          10         10          3          0          2
    0300-0400          11         13          3          0          2
    0400-0500          16         82        287          1          2

I am sure this will be definitely helpful for somebody who is working with postfix mail servers.