Find all Postfix messages sent from an email address
Build a paste-ready command, then review its compatibility and effects before running it.
awk -v sender=<sender-email> 'index($0, "from=<" sender ">")' /var/log/mail.logComplete required fields to copy the generated command.
read-onlyno known side effects Compatibility
Postfix text logsWorks with the traditional syslog-style Postfix log format and the configured maillog_file.
Operational knowledgereview due 2027-01-19
Requirementsawkawk must be installed and available on PATH.
Version supportawk Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsJul 23 09:18:31 mail postfix/qmgr[2142]: 4D92A2F18C: from=<alice@example.com>, size=1842, nrcpt=1 (queue active)Representative successful output; values vary with the selected target and system state.
Known errorsawk: command not foundawk is missing or is not available on PATH.
Verifyawk -v sender={{sender}} 'index($0, "from=<" sender ">")' {{logFile}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01awkCommandRuns the awk stage of this one-liner.
02-vOptionAssigns the following name and value before the awk program runs.
03sender=<sender-email>ParameterA value supplied in the Fill parameters section.
04'index($0, "from=<" sender ">")'ArgumentPasses 'index($0, "from=<" sender ">")' to awk.
05<postfix-log-file>ParameterA value supplied in the Fill parameters section.
Example input
awk -v sender=alice@example.com 'index($0, "from=<" sender ">")' /var/log/mail.log
Example output
Jul 23 09:18:31 mail postfix/qmgr[2142]: 4D92A2F18C: from=<alice@example.com>, size=1842, nrcpt=1 (queue active)
Illustrative output — exact values vary by system and data.
Official sources
Related commands