From e94230521492f3a5c3a7afec77d7a1a499832795 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Tue, 11 Mar 2025 15:15:34 +0100 Subject: [PATCH] MEDIUM: log: change default "host" strategy for log-forward section Historically, log-forward proxy used to preserve host field from input message as much as possible, and if syslog host wasn't provided (rfc5424 '-' or bad rfc3164 or rfc5424 message) then "localhost" or "-" would be used as host when outputting message using rfc3164 or rfc5424. We change that behavior (which corresponds to "keep" host option), so that log-forward now uses "fill" strategy as default: if the host is provided in input message, it is preserved. However if it is missing and IP address from sender is available, we use it. --- doc/configuration.txt | 2 +- src/log.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index cadf5f294..2404544c3 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -5387,12 +5387,12 @@ option host { replace | fill | keep | append } (ie: '-' as input rfc5424 message or non compliant rfc3164 or rfc5424 message), we use the source IP address from the sender as host field. + (This is the default) keep If input message already contains a value for the host field, we keep it. If input message doesn't contain a value for the host field, we set it to 'localhost' (rfc3164) or '-' (rfc5424). - (This is the default) append If input message already contains a value for the host field, we append a comma followed by the IP address from the sender. diff --git a/src/log.c b/src/log.c index 20a8fcfa9..73da32939 100644 --- a/src/log.c +++ b/src/log.c @@ -6070,7 +6070,7 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm) px->accept = frontend_accept; px->default_target = &syslog_applet.obj_type; px->id = strdup(args[1]); - px->options3 |= PR_O3_LOGF_HOST_KEEP; + px->options3 |= PR_O3_LOGF_HOST_FILL; } else if (strcmp(args[0], "maxconn") == 0) { /* maxconn */ if (warnifnotcap(cfg_log_forward, PR_CAP_FE, file, linenum, args[0], " Maybe you want 'fullconn' instead ?"))