]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: explicitly ignore "log-steps" on backends
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 22 Jul 2025 08:14:47 +0000 (10:14 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 22 Jul 2025 08:22:04 +0000 (10:22 +0200)
"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
src/proxy.c

index 72baf675bdb5eacb3964d81a9f78d522c7340134..e47cac34f19aded8154aa24de3635f733ec3cc3f 100644 (file)
@@ -8778,6 +8778,8 @@ log-steps <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 <string>
index 680e046eb39321a16751e2b66a8df053198b7a41..151ac9fde838ffb9d9dbbbca7537f1d1c87b291c 100644 (file)
@@ -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;