]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: log: don't ignore disabled node's options
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 30 Apr 2024 15:52:44 +0000 (17:52 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 30 Apr 2024 16:45:07 +0000 (18:45 +0200)
commit12d08cf912389dcc56409b897c46a3edcc6cbf61
tree56c50eb20ee77551add2d6a9ec5e5ef0d049c408
parent41d7e82e0f92e7fc17ed26496337d4a9f0dca95c
BUG/MEDIUM: log: don't ignore disabled node's options

In 3f2e8d0ed ("MEDIUM: log: lf_* build helpers now take a ctx argument")
I made a mistake, because starting with this commit it is no longer
possible from a node to disable global logformat options.
The result is that when an option is set globally, it cannot be disabled
anymore.

For instance, it is not possible to do this anymore:
  log-format "%{+X}o %{-X}Ts"

The original intent was to prevent encoding options from being
disabled once enabled globally, because when encoding is enabled globally
we start the object enumeration right away (ie: in CBOR and JSON we
announce dynamic map, and for each node we announce the key..), thus it
doesn't make sense to mix encoding types there, unless encoding is only
used per-node, in which case only the value gets encoded, thus it remains
possible to print a value in JSON/CBOR-compatible format while the next
one shouldn't be printed as-is.

Thus, to restore the original behavior, slightly change the logic in
lf_buildctx_prepare() so that only global encoding options take the
precedence over node's options (instead of all options).

No backport needed.
src/log.c