Turn on Dovecot Server Logging for Troubleshooting

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

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

1. Turn on extra logging flags in Dovecot configuration.

herong$ sudo vi /etc/dovecot/conf.d/10-logging.conf

auth_debug = yes
mail_debug = yes
verbose_ssl = yes

2. Restart Dovecot server.

herong$ sudo systemctl restart dovecot

3. Use an email client that uses IMAP with STARTTLS (Opportunistic TLS) to retrieve emails from "herong" on port 143.

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

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

dovecot: imap-login: Debug: SSL alert: close notify
dovecot: imap(herong)...: Debug: Mailbox INBOX: UID 44: Opened mail because: mail stream
dovecot: imap(herong)...: Debug: Mailbox INBOX: UID 44: Opened mail because: prefetch
dovecot: imap(herong)...: Debug: Mailbox INBOX: UID 44: Opened mail because: access
dovecot: imap(herong)...: Debug: Mailbox INBOX: UID 44: Opened mail because: full mail
dovecot: auth: Debug: Loading modules from directory: /usr/lib64/dovecot/auth
dovecot: auth: Debug: Module loaded: /usr/lib64/dovecot/auth/lib20_auth_var_expand...
dovecot: auth: Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
dovecot: auth: Debug: Read auth token secret from /var/run/dovecot/auth-token-secret.dat
dovecot: auth: Debug: auth client connected (pid=11658)
dovecot: imap-login: Debug: SSL: where=0x10, ret=1: before SSL initialization
dovecot: imap-login: Debug: SSL_get_servername() failed
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS read client hello
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write server hello
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write change cipher spec
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: TLSv1.3 write encrypted extensions
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write certificate
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: TLSv1.3 write server certificate ...
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write finished
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: TLSv1.3 early data
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS read finished
dovecot: imap-login: Debug: SSL: where=0x20, ret=1: SSLv3/TLS write session ticket
dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write session ticket
dovecot: imap-login: Debug: SSL: where=0x2002, ret=1: SSL negotiation finished successfully
dovecot: auth: Debug: client in: AUTH#0111#011PLAIN#011service=imap#011...
dovecot: auth: Debug: client passdb out: CONT#0111
dovecot: auth: Debug: client in: CONT
dovecot: auth: Debug: pam(herong,192.168.1....): Performing passdb lookup
dovecot: auth-worker(*): Debug: Loading modules from directory: /usr/lib64/dovecot/auth
dovecot: auth-worker(*): Debug: loaded: /usr/lib64/dovecot/auth/lib20_auth_var_expand_...
dovecot: auth-worker(*): Debug: loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
dovecot: auth-worker(*): Debug: conn unix:auth-worker (*): Server accepted connection (fd=13)
dovecot: auth-worker(*): Debug: conn unix:auth-worker (*): Sending version handshake
dovecot: auth-worker(*): Debug: conn unix:auth-worker (*): auth-worker-1: Handling PASSV ...
dovecot: auth-worker(*): Debug: pam(herong,192.168.1....): Performing passdb lookup
dovecot: auth-worker(*): Debug: pam(herong,192.168.1....): lookup service=dovecot
dovecot: auth-worker(*): Debug: pam(herong,192.168.1....): #1/1 style=1 msg=Password:
dovecot: auth-worker(*): Debug: pam(herong,192.168.1....): Finished passdb lookup
dovecot: auth-worker(*): Debug: conn unix:auth-worker (*): auth-worker-1: Finished
dovecot: auth: Debug: pam(herong,192.168.1....): Finished passdb lookup
dovecot: auth: Debug: auth(herong,192.168.1....): Auth request finished
dovecot: auth: Debug: client passdb out: OK#0111#011user=herong
dovecot: auth: Debug: master in: REQUEST#0113137339393#01111658#0111#
dovecot: auth: Debug: passwd(herong,192.168.1....): Performing userdb lookup
dovecot: auth-worker(*): Debug: conn unix:auth-worker (*): auth-worker-2: Handling USER ...
dovecot: auth-worker(*): Debug: passwd(herong,192.168.1....): Performing userdb lookup
dovecot: auth-worker(*): Debug: passwd(herong,192.168.1....): lookup
dovecot: auth-worker(*): Debug: passwd(herong,192.168.1....): Finished userdb lookup
dovecot: auth-worker(*): Debug: conn unix:auth-worker (*): auth-worker-2: Finished
dovecot: auth: Debug: passwd(herong,192.168.1....): Finished userdb lookup
dovecot: auth: Debug: master userdb out: USER#0113137339393#011herong#011
dovecot: imap-login: Login: user=..., method=PLAIN, rip=192.168.1.11, lip=192.168.1.100,
dovecot: imap(herong)...: Debug: Added userdb setting: plugin/auth_mech=PLAIN
dovecot: imap(herong)...: Debug: Effective uid=1000, gid=1000, home=/home/herong
dovecot: imap(herong)...: Debug: Namespace inbox: type=private, prefix=, sep=,
dovecot: imap(herong)...: Debug: maildir++: root=/home/herong/Maildir, index=,
dovecot: imap(herong)...: Debug: Mailbox Sent: Mailbox opened because: SELECT
dovecot: auth-worker(*): Debug: conn unix:auth-worker (*):
         Disconnected: Connection closed (fd=-1)

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)

 SSL/TLS Secure Connections with Postfix Server

Dovecot - IMAP and POP3 Server

 What Is Dovecot

 Install and Configure Dovecot on CentOS

 Test Dovecot IMAP Server with "telnet" Client

 Test Dovecot POP3 Server with "telnet" Client

 Keep Deleted Emails on Dovecot

Turn on Dovecot Server Logging for Troubleshooting

 "doveadm" Command - Dovecot's Administration Utility

 SSL/TLS Secure Connections with Dovecot Server

 Email Client Tools - Mail User Agents (MUA)

 Mozilla Thunderbird - Mail User Agents (MUA)

 References

 Full Version in PDF/EPUB