From 76acde91076760d760c6384fb2df7a061055e9e6 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Mon, 13 Nov 2023 10:19:12 +0100 Subject: [PATCH] BUG/MINOR: log: keep the ref in dup_logger() This bug was introduced with 969e212 ("MINOR: log: add dup_logsrv() helper function") When duplicating an existing log entry, we must take care to inherit from its original ->ref if it is set, because not doing so would make 28ac0999 ("MINOR: log: Keep the ref when a log server is copied to avoid duplicate entries") ineffective given that global log directives will lose their original reference when duplicated resursively (at least twice), which is what happens when global log directives are first inherited to defaults which are then inherited to a regular proxy at the end of the chain. This can be easily reproduced using the following configuration: |global | log stdout format raw local0 | |defaults | log global | |frontend test | log global | ... Logs from "test" proxy will be duplicated because test incorrectly inherited from global "log" directives twice, which 28ac0999 would normally detect and prevent. No backport needed unless 969e212 gets backported. --- src/log.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/log.c b/src/log.c index c6f817c665..a2d4dc8418 100644 --- a/src/log.c +++ b/src/log.c @@ -1089,7 +1089,10 @@ struct logger *dup_logger(struct logger *def) if (!cpy->conf.file) goto error; } - cpy->ref = def; + + /* inherit from original reference if set */ + cpy->ref = (def->ref) ? def->ref : def; + return cpy; error: -- 2.39.5