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 <noreply@anthropic.com>
This commit is contained in:
chrisandClaude Opus 5.5 committed 2026-11-11 11:01:51 +01:00
1 parent 686f291b68
commit fa96599077
1 file changed
+29 -5
+29 -5
View File
@@ -9746,6 +9746,9 @@ fi # Dovecot 2.4+ quota_clone
## ---
## --- Every line carries the prefix imap(<user>)<pid><session>; 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"