]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: log: change default "host" strategy for log-forward section
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 11 Mar 2025 14:15:34 +0000 (15:15 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 12 Mar 2025 09:55:49 +0000 (10:55 +0100)
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
src/log.c

index cadf5f294a4c2d91c303506505ad41746b815ed1..2404544c37aa40a650bff45bd96c1ac27826336a 100644 (file)
@@ -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.
index 20a8fcfa95977cd3817943ebe4ec39dbba8cb769..73da329396ca344b968e42dffd0b2cd8ffed9d56 100644 (file)
--- 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 ?"))