From fa9659907774f1d45ee53e8e3dc50f987d2769df Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 11 Nov 2026 11:01:51 +0100 Subject: [PATCH] install_update_dovecot-2.4: enable mail_log only for imap, pop3 and lmtp With mail_log loaded globally, doveadm also logs every action to stderr, so cron jobs like "doveadm expunge -A mailbox Spam* savedbefore 30d" produced one output line (and thus cron mail) per expunged message. Scope the plugin to protocol imap/pop3/lmtp blocks in 95-mail-log.conf; client actions and sieve filing are still logged, doveadm stays quiet and only reports real errors. Co-Authored-By: Claude Opus 5.5 --- install_update_dovecot-2.4.sh | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/install_update_dovecot-2.4.sh b/install_update_dovecot-2.4.sh index fd0aee5..9f7378c 100755 --- a/install_update_dovecot-2.4.sh +++ b/install_update_dovecot-2.4.sh @@ -9746,6 +9746,9 @@ fi # Dovecot 2.4+ quota_clone ## --- ## --- Every line carries the prefix imap(); the ## --- session id links it to the imap-login line (rip=, login time). +## --- +## --- Enabled for imap, pop3 and lmtp only - not for doveadm, otherwise +## --- cron jobs running "doveadm expunge" print a line per message. ## ----------------------------------------------------------------- if [[ $dovecot_major_version -gt 2 ]] \ @@ -9767,16 +9770,37 @@ if [[ $dovecot_major_version -gt 2 ]] \ ## -> the session=<...> of the matching imap-login line gives ## client IP (rip=) and login time. ## +## Only enabled for imap, pop3 and lmtp (client actions and sieve +## filing). NOT for doveadm: doveadm writes log lines to stderr, so +## cron jobs like "doveadm expunge ..." would produce output (mail) +## for every expunged message. +## ## see also: https://doc.dovecot.org/${_version}/core/plugins/mail_log.html ## -mail_plugins { - notify = yes - mail_log = yes -} - mail_log_events = ${mail_log_events} mail_log_fields = ${mail_log_fields} + +protocol imap { + mail_plugins { + notify = yes + mail_log = yes + } +} + +protocol pop3 { + mail_plugins { + notify = yes + mail_log = yes + } +} + +protocol lmtp { + mail_plugins { + notify = yes + mail_log = yes + } +} EOF if [ "$?" = 0 ]; then echo -e "$rc_done"