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.
'/etc/postfix/main.cf' file with the editor of your choice and add the line
header_checks = regexp:/etc/postfix/header_checks.
Don’t forget to save it.
Append the line
/^Subject:/ WARN in the file
Now it’s time to run postmap
Restart the postfix server using the command:
Now monitor the flow of subject included in the logs using
tail -f /var/log/mail.log