mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-27 15:12:11 +00:00
BUG/MINOR: cfgparse: report proper location for log-format-sd errors
When a parsing error occurs inside a log-format-sd expression, we report
the location of the log-format directive (which may not be set) instead
of reporting the proper log-format-sd directive location where the parsing
error occured.
1|listen test
2| log-format "%B" # no error
3| log-format-sd "%bad" # error
| [ALERT] (322261) : config : Parsing [empty.conf:2]: failed to parse log-format-sd : no such format variable 'bad'. If you wanted to emit the '%' character verbatim, you need to use '%%'.
The fix consists in using the config hints dedicated to log-format-sd
directive instead of the log-format one.
The bug was introduced in 8a4e4420
("MEDIUM: log-format: Use standard
HAProxy log system to report errors").
This should be backported to every stable versions.
This commit is contained in:
parent
59f08f65fd
commit
cf37e4cc1b
@ -3435,12 +3435,12 @@ out_uri_auth_compat:
|
|||||||
LOG_OPT_MANDATORY|LOG_OPT_MERGE_SPACES,
|
LOG_OPT_MANDATORY|LOG_OPT_MERGE_SPACES,
|
||||||
SMP_VAL_FE_LOG_END, &err)) {
|
SMP_VAL_FE_LOG_END, &err)) {
|
||||||
ha_alert("Parsing [%s:%d]: failed to parse log-format-sd : %s.\n",
|
ha_alert("Parsing [%s:%d]: failed to parse log-format-sd : %s.\n",
|
||||||
curproxy->conf.lfs_file, curproxy->conf.lfs_line, err);
|
curproxy->conf.lfsd_file, curproxy->conf.lfsd_line, err);
|
||||||
free(err);
|
free(err);
|
||||||
cfgerr++;
|
cfgerr++;
|
||||||
} else if (!add_to_logformat_list(NULL, NULL, LF_SEPARATOR, &curproxy->logformat_sd, &err)) {
|
} else if (!add_to_logformat_list(NULL, NULL, LF_SEPARATOR, &curproxy->logformat_sd, &err)) {
|
||||||
ha_alert("Parsing [%s:%d]: failed to parse log-format-sd : %s.\n",
|
ha_alert("Parsing [%s:%d]: failed to parse log-format-sd : %s.\n",
|
||||||
curproxy->conf.lfs_file, curproxy->conf.lfs_line, err);
|
curproxy->conf.lfsd_file, curproxy->conf.lfsd_line, err);
|
||||||
free(err);
|
free(err);
|
||||||
cfgerr++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user