DOC: config: document logformat item naming and typecasting features
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 27 May 2024 10:02:27 +0000 (12:02 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Mon, 27 May 2024 15:04:16 +0000 (17:04 +0200)
The ability to give a name to a logformat_node (known as logformat item in
the documentation) implemented in 2ed6068f2a ("MINOR: log: custom name for
logformat node") wasn't documented.

The same goes for the ability to force the logformat_node's output type to
a specific type implemented in 1448478d62 ("MINOR: log: explicit
typecasting for logformat nodes")

Let's quickly describe such new usages at the start of the custom log
format section.

doc/configuration.txt

index c17f246..6924bf1 100644 (file)
@@ -25925,6 +25925,17 @@ Special alias "%o" may be used to propagate its flags to all other
 logformat items on the same format string. This is particularly handy with
 quoted ("Q") and escaped ("E") string formats.
 
+Items can optionally be named using ('()'). The name must be provided right
+after '%' (before arguments). It will automatically be used as key name when
+encoding flag such as "json" or "cbor" is set. When no encoding flag is
+specified (default), item name will be ignored. It is also possible to force
+the item's output to a given type by appending ':type' after the name, like
+this: %(itemname:itemtype)aliasname or %(itemname:itemtype)[expr] where
+itemtype may be 'str', 'sint' or 'bool'. Specifying the type is only relevant
+when an encoding method is used. Also, it is supported to provide an empty name
+to force the output type on an anonymous item: %(:itemtype), ie: when encoding
+is not set globally, see flags definitions below for more information.
+
 Due to the original goal of custom log formats to be used for logging only,
 there is a special case made of non-printable and unsafe characters (those
 outside ASCII codes 32 to 126 plus a few other ones) depending where they are