NAME
pflogsumm - Produce Postfix MTA logfile summary
Copyright (C) 1998-2026 by James S. Seymour, Release 1.2.0
SYNOPSIS pflogsumm [--config <file>] [--bounce-detail <cnt>] [--colwidth <n>] [-d|--date-range <date [range]>] [--deferral-detail <cnt>] [--detail <cnt>] [--dow0mon] [-e|--extended-detail] [--expired-detail <cnt>] [-h|--host-cnt <cnt>] [-i|--ignore-case] [--iso-date-time] [-m|--uucp-mung] [--mailq] [--no-no-msg-size] [--problems-first] [--pscrn-detail <cnt>] [--pscrn-stats] [-q|--quiet] [--rej-add-from] [--rej-add-to] [--reject-detail <cnt>] [--smtpd-stats] [--srs-mung] [--ssl-tls-stats] [--syslog-name <string>] [-u|--user-cnt <cnt>] [--unprocd-file <filename>] [--use-orig-to] [--verbose-msg-detail] [--verp-mung [n]] [--warning-detail <cnt>] [-x|--debug <file>] [--zero-fill] [file1 [filen]]
pflogsumm --[dump-config|help|version]Note: Where both long- and short-form options exist only thelatter are shown above. See man page for long-form equivalents.If no file(s) specified, reads from stdin. Output is to stdout. Errorsto stderr.
DESCRIPTION
Pflogsumm is a log analyzer/summarizer for the Postfix MTA. It isdesigned to provide an over-view of Postfix activity, with just enoughdetail to give the administrator a "heads up" for potential troublespots.Pflogsumm generates summaries and, in some cases, detailed reports ofmail server traffic volumes, rejected and bounced email, and serverwarnings, errors and panics.
OPTIONS
--bounce-detail <cnt>Limit detailed bounce reports to the top <cnt>. 0to suppress entirely.--config <config file>Path to a configuration file containing pflogsummoptions.Supports all standard command-line options (without theleading "-" or "--"). Options like "config", "dump-config","help", and "version" technically work here, too, thoughthey're not particularly useful in this context.Command-line arguments override config file values exceptfor boolean options.--colwidth <n>Maximum report output width. Default is 80 columns.0 = unlimited.N.B.: --verbose-msg-detail overrides-d <arg>--date-range <arg>Limits the report to the specified date or range.Accepted values:todayyesterday"this week" / "last week""this month" / "last month"YYYY-MM[-DD]"YYYY-MM[-DD] YYYY-MM[-DD]"These options do what they suggest, with oneimportant caveat:ISO 8601 / RFC 3339-style dates and ranges maynot yield accurate results when used withtraditional log formats lacking year information("month day-of-month").In such cases, pflogsumm assumes log entriesare from the current year. For example, if thecurrent month is April and a log contains "AprNN" entries from the previous year, they willbe interpreted as from the *current* April.As such, date-based filtering is only reliablefor entries less than ~365 days old forold-/traditional-style logfiles.Arguments containing spaces must be quoted!This/last week/month arguments can take underscores,rather than spaces, to avoid quoting: E.g.:--date-range last_weekISO 8601/RFC 3339 date ranges may optionally use ahyphen or the word "to" for readability. E.g.:"2025-08-01 to 2025-08-08"If an optional day (DD) is omitted, the range becomesthe full month. E.g.:2025-08 == 2025-08-01 through 2025-08-31"2025-07 - 2025-08" == 2025-07-01 - 2025-08-31--debug <file>Enable debugging to <file>See Also: -x--dow0monFirst day of the week is Monday, rather than Sunday.(Used only for this/last week calculations.)--deferral-detail <cnt>Limit detailed deferral reports to the top <cnt>. 0to suppress entirely.--detail <cnt>Sets all --*-detail, -h and -u to <cnt>. Isover-ridden by individual settings. --detail 0suppresses *all* detail.--dump-configDump the config to STDOUT and exit.This can be used as both a debugging aid and as a wayto develop your first config file. For the latter:Simply run your usual pflogsumm command line, adding--dump-config to it, and redirect STDOUT to a file.To make it cleaner: Remove unset configs:pflogsumm --dump-config <add'l args> |grep -v ' = $'--expired-detail <cnt>Limit detailed message queue time expired reports tothe top <cnt>. 0 to suppress entirely.-e--extended-detailExtended (extreme? excessive?) detailEmit detailed reports. At present, this includesonly a per-message report, sorted by sender domain,then user-in-domain, then by queue i.d.WARNING: the data built to generate this report canquickly consume very large amounts of memory if alot of log entries are processed!-h <cnt>--host-cnt <cnt>top <cnt> to display in host/domain reports.0 = none.See also: "-u" and "--*-detail" options for furtherreport-limiting options.--help Emit short usage message and bail out.(By happy coincidence, "-h" alone does much the same,being as it requires a numeric argument :-). Yeah, Iknow: lame.)-i--ignore-caseHandle complete email address in a case-insensitivemanner.Normally pflogsumm lower-cases only the host anddomain parts, leaving the user part alone. Thisoption causes the entire email address to be lower-cased.--iso-date-timeFor summaries that contain date or time information,use ISO 8601 standard formats (CCYY-MM-DD and HH:MM),rather than "Mon DD CCYY" and "HHMM".-m modify (mung?) UUCP-style bang-pathsThis is for use when you have a mix of Internet-styledomain addresses and UUCP-style bang-paths in the log.Upstream UUCP feeds sometimes mung Internet domainstyle address into bang-paths. This option cansometimes undo the "damage". For example:"somehost.dom!username@foo" (where "foo" is the nexthost upstream and "somehost.dom" was whence the emailoriginated) will get converted to"[email protected]". This also affects theextended detail report (-e), to help ensure that by-domain-by-name sorting is more accurate.See also: --uucp-mung--mailq Run "mailq" command at end of report.Merely a convenience feature. (Assumes that "mailq"is in $PATH. See "$mailqCmd" variable to path thisiif desired.)--no-no-msg-sizeDo not emit report on "Messages with no size data".Message size is reported only by the queue manager.The message may be delivered long-enough after the(last) qmgr log entry that the information is not inthe log(s) processed by a particular run ofpflogsumm. This throws off "Recipients by messagesize" and the total for "bytes delivered." These arenormally reported by pflogsumm as "Messages with nosize data."--problems-firstEmit "problems" reports (bounces, defers, warnings,etc.) before "normal" stats.--pscrn-detail <cnt>Limit postscreen detail reporting to top <cnt> lines ofeach event. 0 to suppress entirely.Note: Postscreen rejects are collected and reportedin any event.--pscrn-statsCollect and emit postscreen summary stats.Note: Postscreen rejects are collected and reportedin any event.--rej-add-fromFor those reject reports that list IP addresses orhost/domain names: append the email from address toeach listing. (Does not apply to "Improper use ofSMTP command pipelining" report.)-q--quietquiet - don't print headings for empty reportsnote: headings for warning, fatal, and "master"messages will always be printed.--rej-add-toFor sender reject reports: Add the intended recipientaddress.--reject-detail <cnt>Limit detailed smtpd reject, warn, hold and discardreports to the top <cnt>. 0 to suppress entirely.--smtp-detail <cnt>Deprecated--smtpd-statsGenerate smtpd connection statistics.The "per-day" report is not generated for single-dayreports. For multiple-day reports: "per-hour" numbersare daily averages (reflected in the report heading).--smtpd-warning-detail <cnt>Deprecated. Use --warning-detail instead.Limit detailed smtpd warnings reports to the top <cnt>.0 to suppress entirely.--srs-mungUndo SRS address munging.If your postfix install has an SRS plugin running, manyaddresses in the report will contain the SRS-formattedemail addresses, also for non-local addresses (f.i.senders). This option will try to undo the "damage".Addresses of the form:[email protected]will be reformatted to their original value:[email protected]--syslog-name=nameSet syslog-name to look for for Postfix log entries.By default, pflogsumm looks for entries in logfileswith a syslog name of "postfix," the default.If you've set a non-default "syslog_name" parameterin your Postfix configuration, use this option totell pflogsumm what that is.See the discussion about the use of this option under"NOTES," below.--ssl-tls-statsReport SMTP TLS statistics and SMTPD SSL/TLS errors.-u <cnt>--user-cnt <cnt>top <cnt> to display in user reports. 0 == none.See also: "-h" and "--*-detail" options for furtherreport-limiting options.--unprocd-file <filename>Emit unprocessed logfile lines to file <filename>--use-orig-toWhere "orig_to" fields are found, report that in placeof the "to" address.--uucp-mungmodify (mung?) UUCP-style bang-pathsSee also: -m--verbose-msg-detailFor the message deferral, bounce and reject summaries:display the full "reason", rather than a truncated one.Note: this can result in quite long lines in the report.--verp-mung [n]If n = 1 or is not provided, perform basic "VERP"address munging, converting sender addresses of the form"[email protected]"to"[email protected]"In other words: replace the numeric value with "ID".If n = 2, the munging is more "aggressive", converting theaddress to something like:"[email protected]"See "NOTES" regarding this option.--version Print program name and version and bail out.--warning-detail <cnt>Limit detailed warnings reports to the top <cnt>.0 to suppress entirely.-x <file> Enable debugging to <file>See Also: --debug--zero-fill "Zero-fill" certain arrays so reports come out withdata in columns that that might otherwise be blank.
RETURN VALUE
Pflogsumm doesn't return anything of interest to the shell.
ERRORS
Error messages are emitted to stderr.
EXAMPLES
Produce a report of previous day's activities:pflogsumm -d yesterday /var/log/maillogA report of prior week's activities:pflogsumm -d last_week /var/log/maillog.0What's happened so far today:pflogsumm -d today /var/log/maillogCrontab entry to generate a report of the previous day's activityat 10 minutes after midnight:10 0 * * * /usr/local/sbin/pflogsumm -d yesterday /var/log/maillog2>&1 |/usr/bin/mailx -s "`uname -n` daily mail stats" postmasterCrontab entry to generate a report for the prior week's activity.10 4 * * 0 /usr/local/sbin/pflogsumm -d "last week" /var/log/maillog.02>&1 |/usr/bin/mailx -s "`uname -n` weekly mail stats" postmaster(The two crontab examples, above, must actually be a single lineeach. They're broken-up into two-or-more lines due to pageformatting issues.)Using a config file:pflogsumm --config /usr/local/etc/pflogusmm/daily.confUsing a config file, overriding a config file options on the commandline:pflogsumm --config /usr/local/etc/pflogsumm/daily.conf--detail 30This would override *all* detail settings in the configfile, setting them all to 30.pflogsumm --config /usr/local/etc/pflogsumm/daily.conf--detail 30 --host-cnt 10This would override all detail settings in the configfile, setting them all to 30, with the global detailsetting in turn being overridden to 10 for host count.
SEE ALSO
pffrombyto, pftobyfromThe pflogsumm FAQ: pflogsumm-faq.txt.
NOTES
Some options, such as date range, have both short-form andlong-form names. In the interest of brevity, only theshort-form options are shown in the SYNOPSIS and inpflogsumm's "help" output.Pflogsumm makes no attempt to catch/parse non-Postfix logentries. Unless it has "postfix/" in the log entry, it will beignored.It's important that the logs are presented to pflogsumm inchronological order so that message sizes are available whenneeded.For display purposes: integer values are munged into "kilo" and"mega" notation as they exceed certain values. I chose theadmittedly arbitrary boundaries of 512k and 512m as the points atwhich to do this--my thinking being 512x was the largest number(of digits) that most folks can comfortably grok at-a-glance.These are "computer" "k" and "m", not 1000 and 1,000,000. Youcan easily change all of this with some constants near thebeginning of the program."Items-per-day" reports are not generated for single-dayreports. For multiple-day reports: "Items-per-hour" numbers aredaily averages (reflected in the report headings).Message rejects, reject warnings, holds and discards are allreported under the "rejects" column for the Per-Hour and Per-Daytraffic summaries.Verp munging may not always result in correct address andaddress-count reduction.Verp munging is always in a state of experimentation. The useof this option may result in inaccurate statistics with regardsto the "senders" count.UUCP-style bang-path handling needs more work. Particularly ifPostfix is not being run with "swap_bangpath = yes" and/or *is* beingrun with "append_dot_mydomain = yes", the detailed by-message reportmay not be sorted correctly by-domain-by-user. (Also depends onupstream MTA, I suspect.)The "percent rejected" and "percent discarded" figures are onlyapproximations. They are calculated as follows (example is for"percent rejected"):percent rejected =(rejected / (delivered + rejected + discarded)) * 100There are some issues with the use of --syslog-name. The problem isthat, even with Postfix' $syslog_name set, it will sometimes stilllog things with "postfix" as the syslog_name. This is noted in/etc/postfix/sample-misc.cf:# Beware: a non-default syslog_name setting takes effect only# after process initialization. Some initialization errors will be# logged with the default name, especially errors while parsing# the command line and errors while accessing the Postfix main.cf# configuration file.As a consequence, pflogsumm must always look for "postfix," in logs,as well as whatever is supplied for syslog_name.Where this becomes an issue is where people are running two or moreinstances of Postfix, logging to the same file. In such a case:. Neither instance may use the default "postfix" syslog nameand.... Log entries that fall victim to what's described insample-misc.cf will be reported under "postfix", so that ifyou're running pflogsumm twice, once for each syslog_name, suchlog entries will show up in each report.The Pflogsumm Home Page is at:http://jimsun.LinxNet.com/postfix_contrib.html
REQUIREMENTS
Requires Perl 5.10, minimum, and Date::CalcFor --config, Pflogsumm requires the Config::Simple module.Both of the above can be obtained from CPAN at http://www.perl.comor from your distro's repository.Pflogsumm is currently written and tested under Perl 5.38.As of version 19990413-02, pflogsumm worked with Perl 5.003, butfuture compatibility is not guaranteed.
LICENSE
This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You may have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.An on-line copy of the GNU General Public License can be foundhttp://www.fsf.org/copyleft/gpl.html.