]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: config: add environment variables for default log format
authorSébastien Gross <sgross@haproxy.com>
Wed, 30 Nov 2022 21:36:50 +0000 (22:36 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Jan 2023 07:23:43 +0000 (08:23 +0100)
commit537b9e7f36d2374c586f4f048b079b3b0147e53c
tree87fd5dffddb102d2b7d79bb6066be4743c846cc2
parent081091187e9618b19bf4a56cf0de4c988343a731
MINOR: config: add environment variables for default log format

This patch provides a convenient way to override the default TCP, HTTP
and HTTP log formats. Instead of having a look into the documentation
to figure out what is the appropriate default log format three new
environment variables can be used: HAPROXY_TCP_LOG_FMT,
HAPROXY_HTTP_LOG_FMT and HAPROXY_HTTPS_LOG_FMT. Their content are
substituted verbatim.

These variables are set before parsing the configuration and are unset
just after all configuration files are successful parsed.

Example:

    # Instead of writing this long log-format line...
    log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC \
                %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r \
                lr=last_rule_file:last_rule_line"

    # ..the HAPROXY_HTTP_LOG_FMT can be used to provide the default
    # http log-format string
    log-format "${HAPROXY_HTTP_LOG_FMT} lr=last_rule_file:last_rule_line"

Please note that nothing prevents users to unset the variables or
override their content in a global section.

Signed-off-by: Sébastien Gross <sgross@haproxy.com>
doc/configuration.txt
src/haproxy.c