How to enable subject information to be logged in postfix mail server logs? πŸ‘‹

Enabling subject information in log storage will help administrators to sort the mails send based on the subject using grep command. In this micro article, we explain a quick 4 steps to enable this.


By default postfix enables the from and to email addresses to be logged but it is possible to capture many useful information in the logs to help administrators or marketing campaign specialists to monitor it in real-time.

Step 1

Edit '/etc/postfix/' file with the editor of your choice and add the line header_checks = regexp:/etc/postfix/header_checks.

Don’t forget to save it.

Step 2

Append the line /^Subject:/ WARN in the file /etc/postfix/header_checks

Step 3

Now it’s time to run postmap postmap /etc/postfix/header_checks

Step 4

Restart the postfix server using the command: postfix reload

Now monitor the flow of subject included in the logs using tail -f /var/log/mail.log