Debug your programs
Another essential part to solve problems is debugging. It differs from a software developer's view, let's say we are talking about "administrator debugging". Most important are logfiles which show us what is done behind the scene. Where is the logfile located for a specific program? What will be logged and how can we change that?
Logfile location
program | location | hint |
---|---|---|
postfix | /var/log/mail.log | postconf syslog_facility |
dovecot | /var/log/dovecot.log /var/log/dovecot-sieve.log /var/log/dovecot-lmtp.log | grep log_path /etc/dovecot/dovecot.conf, doveadm log find |
amavis new | /var/log/mail.log, grep amavis | grep -i syslog /etc/amavis/conf.d/20-debian_defaults |
spamassassin | same as amavis new | |
clamav | /var/log/clamav/clamav.log | grep Log /etc/clamav/clamd.conf |
clamav freshclam | /var/log/clamav/freshclam.log | grep Log /etc/clamav/freshclam.conf |
iredapd | /var/log/iredapd.log | grep log /opt/iredapd/settings.py |
apache | /var/log/apache2/error.log /var/log/apache2/access.log | grep APACHE_LOG_DIR /etc/apache2/envvars |
mysql | /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/error.log | grep log_ /etc/mysql/my.cnf |
roundcube | /var/log/mail.log | grep log /opt/www/roundcubemail/config/config.inc.php |
Log Level
For most programs we can control what should be logged. Default settings avoid that log files fill up too fast. Sometimes we need a deeper look into some specific communication and wish we had more informations. We tell you how you can control the log level:
Postfix
- specific SMTP connections
- vi /etc/postfix/main.cf
- set debug_peer_list = [parameter], you can specify one or more hosts, domains, addresses or net/masks
- apply new settings: postfix reload
- daemon programs
- vi /etc/postfix/master.cf
- one or more "-v" options to selected daemon
- example: smtp inet n - n - - smtpd -v
- debug rewrite adress: cleanup, trivial-rewrite
- debug mail delivery: qmgr, oqmgr, lmtp, local, pipe, smtp, virtual
- Postfix Debugging Howto
Dovecot
- vi /etc/dovecot/dovecot.conf
- set no or yes, default is no: mail_debug, auth_verbose, auth_debug, auth_debug_passwords, verbose_ssl
- set no, plain or sha1, default is no: auth_verbose_passwords
- restart: service dovecot restart
- Details Dovecot logging
iRedAPD
- vi /opt/iredapd/settings.py
- set debug, default is info: log_level
- restart: service iredapd restart
Amavis new
- vi /etc/amavis/conf.d/50-user
- set 0...5, default 0 (off): $log_level
- restart: service amavis restart
Spamassassin
- vi /etc/amavis/conf.d/50-user
- set 1, default is 0 (off): $sa_debug
- $log_level must be > 0
- restart: service amavis restart
Roundcube
- vi /opt/www/roundcubemail/config/config.inc.php
- set 1 or 0, default is o (off): $config['debug_level']
- set true or false: $config['sql_debug'], $config['imap_debug'], $config['ldap_debug'], $config['smtp_debug']
- Roundcube howto report issues
MySql
- vi /etc/mysql/my.cnf
- set 1 or 0, default is 0 (off): general_log_file, slow_query_log
- set n seconds: long_query_time, restart mysql
More about troubleshoot for iRedMail
iRedMail documentation has a few topics about troubleshoot and debug, and lists the paths to config files and log files of major programs.