This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.
Differences between revisions 10 and 11
Revision 10 as of 2007-06-12 12:26:07
Size: 3304
Editor: TimoSirainen
Comment:
Revision 11 as of 2007-06-12 13:21:29
Size: 4013
Editor: TimoSirainen
Comment:
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
By default Dovecot logs to syslog using mail facility. In many systems the info and error messages go to different log files. For example: By default Dovecot logs to syslog using mail facility using several different log levels. In many systems syslog is configured to log messages to different log files depending on the level. The levels and their commonly used log file locations are:
Line 12: Line 12:
 * Info log: {{{/var/log/mail.log}}} or {{{/var/log/maillog}}}
 * Error log: {{{/var/log/mail.err}}}
 * '''info''': Informational and debug messages. {{{/var/log/mail.info}}}
 * '''warn''': Warnings that don't cause an actual error, but are useful to know about. {{{/var/log/mail.warn}}}
 * '''err''': Non-fatal errors. {{{/var/log/mail.err}}}
 * '''crit''': Fatal errors that cause the process to die. There are no commonly used log file for these.
 * Often {{{/var/log/mail.log}}} or {{{/var/log/maillog}}} contains all of the above, but not always.
Line 17: Line 20:
 * Info log: After starting Dovecot, {{{grep 'starting up' /var/log/*}}}. It should show a line such as: {{{Dovecot v1.0.0 starting up}}}
 * Error log: Use {{{dovecot --log-error}}} command. Then {{{grep "This is Dovecot's error log" /var/log/*}}} to find it.
 * Or just check your {{{/etc/syslog.conf}}} to see how it's configured.
 * Info log: After starting Dovecot, {{{grep "starting up" /var/log/*}}}. It should show a line such as: {{{Dovecot v1.0.0 starting up}}}
 * Error logs: Use {{{dovecot --log-error}}} command. Then {{{grep "This is Dovecot's" /var/log/*}}} to find them. You should see:
  * With Dovecot v1.0.0 you'll find only the '''crit''' log: {{{This is Dovecot's error log}}}
  * With Dovecot v1.0.1 you'll
find all the '''warn''', '''err''' and '''crit''' logs:
   * '''warn''': {{{This is Dovecot's warning log}}}
   * '''err''': {{{This is Dovecot's error log}}}
   * '''crit''': {{{This is Dovecot's
fatal log}}}
Line 21: Line 28:
Dovecot actually also logs warnings sometimes. They usually go to the error log, but depending on syslog configuration they may go to their own log file as well. It's probably a good idea to make warnings go to the error log so you don't forget to look at them. You can also check your {{{/etc/syslog.conf}}} to see how it's configured. A good configuration for Dovecot could be:

{{{
mail.* -/var/log/mail.log
mail.warn;mail.err;mail.crit -/var/log/mail.err
}}}

TableOfContents

Dovecot Logging

Dovecot always logs a detailed error message if something goes wrong. If it doesn't, it's considered a bug and will be fixed. However almost always the problem is that you're looking at the wrong log file. Dovecot uses two different logs:

  • Info log: All informational and debug messages are logged here. It may also contain some vague error messages, which are also logged in more detail in the error log.
  • Error log: All errors are logged here. As long as there are no errors, nothing is ever written here.

By default Dovecot logs to syslog using mail facility using several different log levels. In many systems syslog is configured to log messages to different log files depending on the level. The levels and their commonly used log file locations are:

  • info: Informational and debug messages. /var/log/mail.info

  • warn: Warnings that don't cause an actual error, but are useful to know about. /var/log/mail.warn

  • err: Non-fatal errors. /var/log/mail.err

  • crit: Fatal errors that cause the process to die. There are no commonly used log file for these.

  • Often /var/log/mail.log or /var/log/maillog contains all of the above, but not always.

You can find the correct log files using these methods:

  • Info log: After starting Dovecot, grep "starting up" /var/log/*. It should show a line such as: Dovecot v1.0.0 starting up

  • Error logs: Use dovecot --log-error command. Then grep "This is Dovecot's" /var/log/* to find them. You should see:

    • With Dovecot v1.0.0 you'll find only the crit log: This is Dovecot's error log

    • With Dovecot v1.0.1 you'll find all the warn, err and crit logs:

      • warn: This is Dovecot's warning log

      • err: This is Dovecot's error log

      • crit: This is Dovecot's fatal log

You can also check your /etc/syslog.conf to see how it's configured. A good configuration for Dovecot could be:

mail.*                          -/var/log/mail.log
mail.warn;mail.err;mail.crit  -/var/log/mail.err

Internal Errors

If IMAP or POP3 processes encounter some error, they don't show the exact reason for clients. Instead they show:

Internal error occurred. Refer to server log for more information. [2006-01-07 22:35:11]

The point is that whenever anything unexpected happens, Dovecot doesn't leak any extra information about it to clients. They don't need it and they might try to exploit it in some ways, so the less they know the better.

The real error message is written to the error log file. The timestamp is meant to help you find it.

Changing Log File Paths

If you don't want to use syslog, or if you just can't find the Dovecot's error logs, you can make Dovecot log elsewhere as well:

log_path = /var/log/dovecot.log
# If you want everything in one file, just don't specify info_log_path
info_log_path = /var/log/dovecot-info.log

The error messages will go to file specified by log_path, while everything else goes to info_log_path. If you do this, make sure you're really looking at the log_path file for error messages, since the "Starting up" message is written to info_log_path file.

Rotating Logs

If you change from syslog to an external log file, you can use logrotate (available on most recent linux distros) to maintain the Dovecot logfile so it doesn't grow beyond a manageable size. Save the below scriptlet as /etc/logrotate.d/dovecot:

# dovecot SIGUSR1: Re-opens the log files.
/var/log/dovecot*.log {
  missingok
  notifempty
  delaycompress
  sharedscripts
  postrotate
    /bin/kill -USR1 `cat /var/run/dovecot/master.pid 2>/dev/null` 2> /dev/null || true
  endscript
}

NOTE: change the path to the logfile(s) and the master.pid file as appropriate for your system configuration.

None: Logging (last edited 2009-10-28 03:05:44 by TimoSirainen)