TCP logs currently work fairly badly due to connections closing
immediately after logs are sent (or at best a full buffer of logs).
This started to happen in 3.1 with commit
237849c911 ("MEDIUM: sink:
"max-reuse" support for sink servers") thow that commit is not faulty,
the issue stems to the complex server creation chain.
What happens is that max_reuse >= 0 means the max-reuse setting is
enable, and the sink server creation in sink_new_from_logger() creates
a server but doesn't initialize it. Other servers are not exactly
initialized, they're preset from defaults which are initialized. But
here we don't inherit defaults so we must call srv_settings_init(),
otherwise max_reuse remains zero and connections are closed after each
message.
This must be backported to 3.2.
if (!srv)
goto error;
+ /* there will be no defaults, we must initialize settings */
+ srv_settings_init(srv);
+
/* init server */
srv->id = strdup(logger->target.ring_name);
srv->conf.file = strdup(logger->conf.file);