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.
This commit is contained in:
Aurelien DARRAGON 2025-07-22 10:14:47 +02:00
parent e02939108e
commit 054fa05e1f
2 changed files with 5 additions and 2 deletions

View 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>

View 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;