Turn on Postfix Server Logging for Troubleshooting

This section provides a tutorial example on how to turn on how to change logging flags on Postfix server to record extra debugging messages in log file for troubleshooting issues.

If you are running into issues with the Postfix server, you may want to increase logging levels to help troubleshooting issues.

1. Turn on extra logging flags in Postfix configuration files.

herong$ sudo vi /etc/postfix/main.cf
  smtpd_tls_loglevel = 3

herong$ sudo vi /etc/postfix/master.cf
  submission inet n       -       n       -       -       smtpd
    -o syslog_name=postfix/submission
    ...

  smtps     inet  n       -       n       -       -       smtpd
    -o syslog_name=postfix/smtps
    ...

2. Restart Postfix server.

herong$ sudo systemctl restart postfix

3. Use an email client uses SMTPS (SMTP Secure) to submit a new email to herong on port 465.

4. Look at the Postfix server log file. I see log messages for the entire connection session.

herong$ sudo tail -200 /var/log/maillog

postfix/smtps/smtpd[*]: initializing the server-side TLS engine
postfix/smtps/smtpd[*]: connect from unknown[192.168.1.11]
postfix/smtps/smtpd[*]: setting up TLS connection from unknown[192.168.1.11]
postfix/smtps/smtpd[*]: unknown[192.168.1.11]: TLS cipher list "aNULL:-aNULL:HIGH:..."
postfix/smtps/smtpd[*]: SSL_accept:before SSL initialization
postfix/smtps/smtpd[*]: read from 5609576C6710 [5609576CEAB3] (5 bytes => 5 (0x5))
postfix/smtps/smtpd[*]: 0000 16 03 01 02
...
postfix/smtps/smtpd[*]: read from 5609576C6710 [5609576CEAB8] (512 bytes => 512 ...)
postfix/smtps/smtpd[*]: 0000 01 00 01 fc 03 03 5a 01|99 5a 6f 35 62 2a 6c 82  ...
...
postfix/smtps/smtpd[*]: SSL_accept:before SSL initialization
postfix/smtps/smtpd[*]: SSL_accept:SSLv3/TLS read client hello
postfix/smtps/smtpd[*]: SSL_accept:SSLv3/TLS write server hello
postfix/smtps/smtpd[*]: SSL_accept:SSLv3/TLS write change cipher spec
postfix/smtps/smtpd[*]: SSL_accept:TLSv1.3 write encrypted extensions
postfix/smtps/smtpd[*]: SSL_accept:SSLv3/TLS write certificate
postfix/smtps/smtpd[*]: SSL_accept:TLSv1.3 write server certificate verify
postfix/smtps/smtpd[*]: write to 5609576C6710 [5609576D6C60] (2407 bytes => 2407 (0x967))
postfix/smtps/smtpd[*]: 0350 29 6f 0e 27 08 43 45 96|9d dd 5c d9 96 1f ea 25  )o.'...
...
postfix/smtps/smtpd[*]: SSL_accept:SSLv3/TLS write finished
postfix/smtps/smtpd[*]: SSL_accept:TLSv1.3 early data
postfix/smtps/smtpd[*]: read from 5609576C6710 [5609576CEAB3] (5 bytes => -1 (...))
postfix/smtps/smtpd[*]: read from 5609576C6710 [5609576CEAB3] (5 bytes => 5 (0x5))
postfix/smtps/smtpd[*]: 0000 14 03 03 00 01                                   .....
postfix/smtps/smtpd[*]: read from 5609576C6710 [5609576CEAB8] (1 bytes => 1 (0x1))
postfix/smtps/smtpd[*]: 0000 01                                               .
postfix/smtps/smtpd[*]: read from 5609576C6710 [5609576CEAB3] (5 bytes => 5 (0x5))
postfix/smtps/smtpd[*]: 0000 17 03 03 00 35                                   ....5
postfix/smtps/smtpd[*]: read from 5609576C6710 [5609576CEAB8] (53 bytes => 53 (0x35))
postfix/smtps/smtpd[*]: 0000 eb 40 8e db 50 98 f5 2c|76 47 32 ea 03 86 06 8a  .@..P.., vG2.....
...
postfix/smtps/smtpd[*]: SSL_accept:TLSv1.3 early data
postfix/smtps/smtpd[*]: SSL_accept:SSLv3/TLS read finished
postfix/smtps/smtpd[*]: unknown[192.168.1.11]: Issuing session ticket, key expiration: ...
postfix/smtps/smtpd[*]: write to 5609576C6710 [5609576D6C60] (239 bytes => 239 (0xEF))
postfix/smtps/smtpd[*]: 0000 17 03 03 00 ea 37 ec 49|ff 9f d8 e8 85 2e 28 0d  ...
...
postfix/smtps/smtpd[*]: SSL_accept:SSLv3/TLS write session ticket
postfix/smtps/smtpd[*]: unknown[192.168.1.11]: Issuing session ticket, key expiration: ...
postfix/smtps/smtpd[*]: write to 5609576C6710 [5609576D6C60] (239 bytes => 239 (0xEF))
postfix/smtps/smtpd[*]: 0000 17 03 03 00 ea 43 54 80|3e b7 13 5f 2e e1 44 60  ...
...
postfix/smtps/smtpd[*]: SSL_accept:SSLv3/TLS write session ticket
postfix/smtps/smtpd[*]: Anonymous TLS connection established from unknown[192.168.1.11]:
                        TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
postfix/smtps/smtpd[*]: 04C08266002F: client=unknown[192.168.1.11]
...
postfix/cleanup[11654]: 04C08266002F: message-id=<2a35c3c8-...@herongyang.com>
postfix/qmgr[2554]: 04C08266002F: from=<herong@example.com>, size=651, nrcpt=1 (queue active)
postfix/smtps/smtpd[*]: disconnect from unknown[192.168.1.11] ehlo=1 mail=1 rcpt=1 data=1 ...
postfix/local[11655]: 04C08266002F: to=<herong@example.com>, relay=local, ...
postfix/qmgr[2554]: 04C08266002F: removed

If something went wrong, hope you will find detailed error messages in the log file.

Table of Contents

 About This Book

 Introduction to Email

Postfix - Mail Transport Agent (MTA)

 What Is Postfix

 Install and Configure Postfix on CentOS

 Test Postfix Server with "telnet" Client

 SMTP Submission Service on Port 587 in Postfix

 Archive Emails using "always_bcc" Setting in Postfix

 Move /var/spool/postfix to New Location

 "postconf" Command to Manage Postfix Configuration

Turn on Postfix Server Logging for Troubleshooting

 SSL/TLS Secure Connections with Postfix Server

 Dovecot - IMAP and POP3 Server

 SSL/TLS Secure Connections with Dovecot Server

 Email Client Tools - Mail User Agents (MUA)

 Mozilla Thunderbird - Mail User Agents (MUA)

 PHPMailer - PHP Package for Sending Emails

 Email Message Format and Headers

 References

 Full Version in PDF/EPUB