By default Postfix MTA only capture ‘From’ and ‘To’ details in the log file (/var/log/maillog).  There are some scenarios where we want that email’s subject should be capture in the maillog. This will very useful for email administrators when performing troubleshooting of problems related with email. There are simple steps to enable logging of the email subject in postfix maillog.
We are assuming that postfix is already up and running and will make below changes.
Step:1 Edit ‘/etc/postfix/main.cf’ file & uncomment below line:
OR do the following
Now see the mail logs using the command ‘tailf -f /var/log/maillog | grep @‘
We are assuming that postfix is already up and running and will make below changes.
Step:1 Edit ‘/etc/postfix/main.cf’ file & uncomment below line:
#header_checks = regexp:/etc/postfix/header_checks/^Subject:/     WARN[root@server1 ~]# postmap /etc/postfix/header_checks[root@server1 ~]# systemctl restart postfix
[root@server1 ~]# postfix reloadOR do the following
[root@server1 ~]# tail -f /var/log/maillog | grep @


Comments
Post a Comment
You are always welcome to comment here, but your remarks should be relevant to the conversation. To keep the exchanges focused and engaging, we reserve the right to remove off-topic comments, or self-promoting URLs and vacuous messages.
We will try to reply to your queries as soon as time allows.
Regards,
Admin