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.
This commit is contained in:
Aurelien DARRAGON 2025-03-11 15:15:34 +01:00
parent ad0133cc50
commit e942305214
2 changed files with 2 additions and 2 deletions

View 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.

View File

@ -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 ?"))