From 054fa05e1fa90b4a43c268917a31fbbfb109f14d Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Tue, 22 Jul 2025 10:14:47 +0200 Subject: [PATCH] MINOR: log: explicitly ignore "log-steps" on backends "log-steps" was already ignored if directly defined in a backend section, however, when defined in a defaults section it was inherited to all proxies no matter their capability (ie: including backends). As configurations often contain more backends than frontends, this would result in wasted memory given that the log-steps setting is only considered on frontends. Let's fix that by preventing the inheritance from defaults section to anything else than frontends. Also adjust the documentation to mention that the setting in not relevant for backends. --- doc/configuration.txt | 2 ++ src/proxy.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 72baf675b..e47cac34f 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -8778,6 +8778,8 @@ log-steps with log-profiles is really interesting to have fine-grained control over logs automatically generated by haproxy during transaction processing. + This setting is only relevant on frontends, it is ignored on backends. + See also : "log-profile" log-tag diff --git a/src/proxy.c b/src/proxy.c index 680e046eb..151ac9fde 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1794,7 +1794,7 @@ static int proxy_defproxy_cpy(struct proxy *curproxy, const struct proxy *defpro { struct logger *tmplogger; char *tmpmsg = NULL; - struct eb32_node *node; + struct eb32_node *node = NULL; /* set default values from the specified default proxy */ @@ -2027,7 +2027,8 @@ static int proxy_defproxy_cpy(struct proxy *curproxy, const struct proxy *defpro * drop the const in order to use EB tree API, please note however * that the operations performed below should theoretically be read-only */ - node = eb32_first((struct eb_root *)&defproxy->conf.log_steps); + if (curproxy->cap & PR_CAP_FE) // don't inherit on backends + node = eb32_first((struct eb_root *)&defproxy->conf.log_steps); while (node) { struct eb32_node *new_node; -- 2.47.2