]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Conf] Make logging type and filename env-overridable
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 29 May 2026 07:36:12 +0000 (08:36 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 29 May 2026 07:36:12 +0000 (08:36 +0100)
Template the baseline logging block so deployments can switch logging
without patching conf/rspamd.conf:

    type = "{= env.LOG_TYPE|default('file') =}";
    filename = "{= env.LOG_FILE|default('$LOGDIR/rspamd.log') =}";

With no RSPAMD_LOG_TYPE/RSPAMD_LOG_FILE set the values render to the
previous hardcoded defaults (file, $LOGDIR/rspamd.log), so stock
installs are unchanged. A container can now set RSPAMD_LOG_TYPE=console
to log to stdout. Mirrors the env-template style introduced for the
worker bind_socket lines.

conf/rspamd.conf

index aa2530b555972a6df11c11d162140b6bb8f0a0b1..97bbdf5b4186714550799cabd7954a6d4b507dac 100644 (file)
@@ -31,8 +31,10 @@ lang_detection {
 }
 
 logging {
-    type = "file";
-    filename = "$LOGDIR/rspamd.log";
+    # Defaults to file logging; a deployment can export RSPAMD_LOG_TYPE
+    # (e.g. console or syslog) and RSPAMD_LOG_FILE to override without a patch.
+    type = "{= env.LOG_TYPE|default('file') =}";
+    filename = "{= env.LOG_FILE|default('$LOGDIR/rspamd.log') =}";
     .include "$CONFDIR/logging.inc"
     .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/logging.inc"
     .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/logging.inc"