]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: log: consider format expression dependencies to decide when to log
authorWilly Tarreau <w@1wt.eu>
Mon, 20 Apr 2026 15:59:53 +0000 (17:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Apr 2026 06:01:07 +0000 (08:01 +0200)
commite51be30f78a62fa53b640f62d4405e3cbabe517e
treee04e2c585d67636c29c7865e9c36593e4fc4d323
parent95c400d08ec442606e0df4aaf0fbf57459d18bc9
BUG/MINOR: log: consider format expression dependencies to decide when to log

Log-format properly takes into account the LW_* flags set by the log
aliases, however its consideration for the sample fetch expressions is
very minimalistic (HTTP y/n). It poses a problem because logging some
statistics doesn't work unless some log aliases are involved to force
the log to wait till the end.

Before this change, the following log-format:

    log-format "res.timer.data=%[res.timer.data]"

would log "res.timer.data=0" regardless of the time taken to transfer
data, and the log would be emitted instantly. However, this line:

    log-format "res.timer.data=%[res.timer.data] %B"

would properly log the time taken to transfer the data because %B which
carries the log flag LW_BYTES forces the log to wait till the end.

This patch makes sure that anything requiring response (headers or body)
waits for at least the response, and that anything requiring response body
or end of transfer (req/res) waits till the end (LW_BYTES). Thanks to
this, the log above is now correct even without the "%B" hack.

This should be backported at least till the latest LTS.
src/log.c