Saturday, September 26, 2015

Postfix mail log with Subject line - Parallel Plesk Panel

We need mail subject in our Logs when we manage several domains with lots of mail IDs for better mail troubleshooting,

For postfix, normally don't have setting for mail log with subject line. But we have do it with simple trick on postfix configuration. Just follow bellow steps, It wont affect any off your mail services, but your log storage will increase some amount.

1. Open your postfix config file with your favoret text editor, mine always vim
vim /etc/postfix/main.cf

2. Find bellow line and un comment it, if commented.
header_checks = regexp:/etc/postfix/header_checks

3. Open file /etc/postfix/header_checks with your editor
vim /etc/postfix/header_checks

4. Add bellow line and save,
/^Subject:/     INFO

5. Restart postfix
service postfix restart

Send mail from your webmail and verify log by following comment. 
tail -f /var/log/maillog | grep Subject

For Plesk,

tail -f /usr/local/psa/var/log/maillog | grep Subject

Note " | grep Subject" used to filter only subject line, you can remove it as per your needs

No comments: