pflogsumm reads Postfix logs and produces a short report: messages received and delivered, bounces, deferrals, rejections, top senders and recipients, and server warnings. It’s the quickest way to spot a spam run, a blacklisting or a misconfiguration before users notice.
Install
sudo apt install pflogsummGenerate a report
# Today so farnsudo pflogsumm -d today /var/log/mail.lognn# Yesterday (complete day)nsudo pflogsumm -d yesterday /var/log/mail.lognn# Everything in the current log filensudo pflogsumm /var/log/mail.logThe options worth knowing
| Option | What it does |
|---|---|
--problems-first | Puts bounces, deferrals, rejections and warnings at the top |
--rej-add-from | Adds the sender address to each rejection line |
--verbose-msg-detail | Shows the full reason instead of a truncated one |
-q | Quiet – skips headings for empty sections |
-u 10 / -h 10 | Limits the top-users and top-hosts lists |
--smtpd-stats | Adds connection statistics |
sudo pflogsumm -d yesterday /var/log/mail.log u002du002dproblems-first u002du002drej-add-from u002du002dverbose-msg-detail -qEmail the report every morning
Open root’s crontab:
sudo crontab -eAdd these lines – the report for the previous day arrives at 02:00:
MAILTO=u0022postmaster@example.comu0022n0 2 * * * /usr/sbin/pflogsumm -d yesterday /var/log/mail.log u002du002dproblems-first u002du002drej-add-from u002du002dverbose-msg-detail -qTo send to a different address with a clear subject, pipe the output to mail (from the mailutils package):
0 2 * * * /usr/sbin/pflogsumm -d yesterday /var/log/mail.log u002du002dproblems-first -q | mail -s u0022Postfix report $(hostname)u0022 you@example.comLog rotation
Ubuntu rotates mail.log daily. If the 02:00 report misses entries, run it shortly before rotation or point it at both files: /var/log/mail.log.1 /var/log/mail.log. Build other schedules with the Crontab Generator.
Full option list: man pflogsumm.

