mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
In e709e1e ("MEDIUM: logs: buffer targets now rely on new sink_write") we started using the sink API instead of using the ring_write function directly. But as indicated in the commit message, the maxlen parameter of the log directive now only applies to the message part and not the complete payload. I don't know what the original intent was (maybe minimizing code changes) but it seems wrong, because the doc doesn't mention this special case, and the result is that the ring->buffer output can differ from all other log output types, making it very confusing. One last issue with this is that log messages can end up being dropped at runtime, only for the buffer target, and even if logsrv->maxlen is correctly set (including default: 1024) because depending on the generated header size the payload can grow bigger than the accepted sink size (sink maxlen is not mandatory) and we have no simple way to detect this at configuration time. First, we partially revert e709e1e: TARGET_BUFFER still leverages the proper sink API, but thanks to "MINOR: sink: pass explicit maxlen parameter to sink_write()" we now explicitly pass the logsrv->maxlen to the sink_write function in order to stop writing as soon as either sink->maxlen or logsrv->maxlen is reached. This restores pre-e709e1e behavior with the added benefit from using the high-level API, which includes automatically announcing dropped message events. Then, we also need to take the ending '\n' into account: it is not explicitly set when generating the logline for TARGET_BUFFER, but it will be forcefully added by the sink_forward_io_handler function from the tcp handler applet when log messages from the buffer are forwarded to tcp endpoints. In current form, because the '\n' is added later in the chain, maxlen is not being considered anymore, so the final log message could exceed maxlen by 1 byte, which could make receiving servers unhappy in logging context. To prevent this, we sacrifice 1 byte from the logsrv->maxlen to ensure that the final message will never exceed log->maxlen, even if the '\n' char is automatically appended later by the forwarding applet. Thanks to this change TCP (over RING/BUFFER) target now behaves like FD and UDP targets. This commit depends on: - "MINOR: sink: pass explicit maxlen parameter to sink_write()" It may be backported as far as 2.2 [For 2.2 and 2.4 the patch does not apply automatically, the sink_write() call must be updated by hand]
The HAProxy documentation has been split into a number of different files for ease of use. Please refer to the following files depending on what you're looking for : - INSTALL for instructions on how to build and install HAProxy - BRANCHES to understand the project's life cycle and what version to use - LICENSE for the project's license - CONTRIBUTING for the process to follow to submit contributions The more detailed documentation is located into the doc/ directory : - doc/intro.txt for a quick introduction on HAProxy - doc/configuration.txt for the configuration's reference manual - doc/lua.txt for the Lua's reference manual - doc/SPOE.txt for how to use the SPOE engine - doc/network-namespaces.txt for how to use network namespaces under Linux - doc/management.txt for the management guide - doc/regression-testing.txt for how to use the regression testing suite - doc/peers.txt for the peers protocol reference - doc/coding-style.txt for how to adopt HAProxy's coding style - doc/internals for developer-specific documentation (not all up to date)
Description
Languages
C
98.1%
Shell
0.8%
Makefile
0.5%
Lua
0.2%
Python
0.2%