Skip to content

Instantly share code, notes, and snippets.

@olmosleo
Last active August 6, 2021 01:13
Show Gist options
  • Save olmosleo/30dd7d9ba0b6e7591a81e38c4c623005 to your computer and use it in GitHub Desktop.
Save olmosleo/30dd7d9ba0b6e7591a81e38c4c623005 to your computer and use it in GitHub Desktop.
pflogsumm - Postfix Report Tools
### PFLOGSUMM - Postfix report ################
# pflogsumm.pl is designed to provide an over-view of postfix activity, with just enough detail to give the administrator
# a "heads up" for potential trouble spots.
# The following is an over-view of the reports produced:
sudo yum install perl-Date-Calc
cd /usr/local/
sudo curl -O http://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz
sudo tar -xzf pflogsumm-1.1.3.tar.gz
sudo mv pflogsumm-1.1.3 pflogsumm
sudo chmod +x pflogsumm/pflogsumm.pl
sudo perl /usr/local/pflogsumm/pflogsumm.pl /var/log/maillog
##
## 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
## Optional detail of messages received, sorted by domain, then sender-in-domain, with a list of recipients-per-message.
## Optional output of "mailq" run
######### CRON REPORT SETTING ##############################################################################
sudo perl /usr/local/pflogsumm/pflogsumm.pl /var/log/maillog | mailx -s "POSTFIX Reporte" correo@destino.com
############################################################################################################
## Example of mail report ##################################################################################
#Grand Totals
#------------
#messages
# 0 received
# 3 delivered
# 0 forwarded
# 4 deferred (70 deferrals)
# 0 bounced
# 0 rejected (0%)
# 0 reject warnings
# 0 held
# 0 discarded (0%)
# 0 bytes received
# 7733 bytes delivered
# 0 senders
# 0 sending hosts/domains
# 1 recipients
# 1 recipient hosts/domains
#Per-Day Traffic Summary
#-----------------------
# date received delivered deferred bounced rejected
# --------------------------------------------------------------------
# Sep 3 2017 0 3 62
# Sep 4 2017 0 0 8
#Per-Hour Traffic Daily Average
#------------------------------
# time received delivered deferred bounced rejected
# --------------------------------------------------------------------
# 0000-0100 0 0 1 0 0
# 0100-0200 0 0 1 0 0
# 0200-0300 0 0 1 0 0
# 0300-0400 0 0 1 0 0
# 0400-0500 0 0 2 0 0
# 0500-0600 0 0 3 0 0
# 0600-0700 0 0 3 0 0
# 0700-0800 0 0 2 0 0
# 0800-0900 0 0 2 0 0
# 0900-1000 0 0 2 0 0
# 1000-1100 0 0 2 0 0
# 1100-1200 0 0 2 0 0
# 1200-1300 0 0 2 0 0
# 1300-1400 0 0 2 0 0
# 1400-1500 0 0 1 0 0
# 1500-1600 0 0 2 0 0
# 1600-1700 0 0 2 0 0
# 1700-1800 0 0 2 0 0
# 1800-1900 0 0 2 0 0
# 1900-2000 0 0 2 0 0
# 2000-2100 0 2 2 0 0
# 2100-2200 0 0 0 0 0
# 2200-2300 0 0 1 0 0
# 2300-2400 0 0 1 0 0
#Host/Domain Summary: Message Delivery
#--------------------------------------
# sent cnt bytes defers avg dly max dly host/domain
# -------- ------- ------- ------- ------- -----------
# 3 7733 0 0.0 s 0.0 s dominio.org
# 0 0 70 0.0 s 121.0 h dominio.cl
#Host/Domain Summary: Messages Received
#---------------------------------------
# msg cnt bytes host/domain
# -------- ------- -----------
#Senders by message count: none
#Recipients by message count
#---------------------------
# 3 prueba@dominio.cl
#Senders by message size: none
#Recipients by message size
#--------------------------
# 7733 prueba@dominio.cl
#message deferral detail
#-----------------------
# smtp (total: 70)
# 70 25: Connection timed out
#message bounce detail (by relay): none
#message reject detail: none
#message reject warning detail: none
#message hold detail: none
#message discard detail: none
#smtp delivery failures: none
#Warnings: none
#Fatal Errors: none
#Panics: none
#Master daemon messages: none
######################## END LINE ########################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment