]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: log: support "raw" logformat node typecast
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 1 Apr 2025 18:25:08 +0000 (20:25 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 2 Apr 2025 09:04:43 +0000 (11:04 +0200)
commit423cca64b632771235f2633f5c2a8b9855317cf4
tree2034b2d8b1a180eca732b452cb92bc7bace3d3c9
parent31bd3627cd627536c749576a357ba0bf8a73b9d1
MINOR: log: support "raw" logformat node typecast

"raw" logformat node typecast is a special value (unlike str,bool,int..)
which tells haproxy to completely ignore logformat options (including
encoding ones) and force binary output for the current node only. It is
mainly intended for use with JSON or CBOR encoders in order to generate
nested CBOR or nested JSON by storing intermediate log-formats within
variables and assembling the final object in the parent log-format.

Example:

  http-request set-var-fmt(txn.intermediate) "%{+json}o %(lower)[str(value)]"

  log-format "%{+json}o %(upper)[str(value)] %(intermediate:raw)[var(txn.intermediate)]"

Would produce:

   {"upper": "value", "intermediate": {"lower": "value"}}
src/log.c