]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: log: add +bin logformat node option
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 25 Apr 2024 14:29:01 +0000 (16:29 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Fri, 26 Apr 2024 16:39:31 +0000 (18:39 +0200)
commitb7c3d8c87cafc568bd9cfa1eb0a283fe931623ac
tree198d662a49d67a0d683d457300bb5d79ff04b387
parent162e311a0e8dfb96525af321c000b5a9d5857d19
MINOR: log: add +bin logformat node option

Support '+bin' option argument on logformat nodes to try to preserve
binary output type with binary sample expressions.

For this, we rely on the log/sink API which is capable of conveying binary
data since all related functions don't search for a terminating NULL byte
in provided log payload as they take a string pointer and a string length
as argument.

Example:
  log-format "%{+bin}o %[bin(00AABB)]"

Will produce:
  00aabb

(output was piped to `hexdump  -ve '1/1 "%.2x"'` to dump raw bytes as HEX
characters)

This should be used carefully, because many syslog endpoints don't expect
binary data (especially NULL bytes). This is mainly intended for use with
set-var-fmt actions or with ring/udp log endpoints that know how to deal
with such binary payloads.

Also, this option is only supported globally (for use with '%o'), it will
not have any effect when set on an individual node. (it makes no sense to
have binary data in the middle of log payload that was started without
binary data option)
doc/configuration.txt
include/haproxy/log-t.h
src/log.c