]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: log: postpone the decision to send or not log with empty messages
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 5 Mar 2025 10:28:14 +0000 (11:28 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 5 Mar 2025 14:38:52 +0000 (15:38 +0100)
commitc7abe7778e3a89f914dfecbff6eb8f6c19b9d17f
treea9df8dec3ee2b788b69dccbfa38de5ee7f901173
parent9e9b110032b767969e50b48bf292741ff21c6436
MEDIUM: log: postpone the decision to send or not log with empty messages

As reported by Nick Ramirez in GH #2891, it is currently not possible to
use log-profile without a log-format set on the proxy.

This is due to historical reason, because all log sending functions avoid
trying to send a log with empty message. But now with log-profile which
can override log-format, it is possible that some loggers may actually
end up generating a valid log message that should be sent! Yet from the
upper logging functions we don't know about that because loggers are
evaluated in lower API functions.

Thus, to avoid skipping potentially valid messages (thanks to log-profile
overrides), in this patch we postpone the decision to send or not empty
log messages in lower log API layer, ie: _process_send_log_final(), once
the log-profile settings were evaluated for a given logger.

A known side-effect of this change is that fe->log_count statistic may
be increased even if no log message is sent because the message was empty
and even the log-profile didn't help to produce a non empty log message.
But since configurations lacking proxy log-format are not supposed to be
used without log-profile (+ log steps combination) anyway it shouldn't be
an issue.
src/log.c