DOC: cfgparse: Warn on option (tcp|http)log in backend

The option does not seem to have any effect since at least haproxy
1.3. Also the `log-format` directive already warns when being used
in a backend.
This commit is contained in:
Tim Duesterhus 2018-02-05 20:52:27 +01:00 committed by Willy Tarreau
parent c5d11c6b33
commit 9ad9f3517e
2 changed files with 14 additions and 6 deletions

View File

@ -6071,7 +6071,7 @@ no option httpclose
option httplog [ clf ] option httplog [ clf ]
Enable logging of HTTP request, session state and timers Enable logging of HTTP request, session state and timers
May be used in sections : defaults | frontend | listen | backend May be used in sections : defaults | frontend | listen | backend
yes | yes | yes | yes yes | yes | yes | no
Arguments : Arguments :
clf if the "clf" argument is added, then the output format will be clf if the "clf" argument is added, then the output format will be
the CLF format instead of HAProxy's default HTTP format. You can the CLF format instead of HAProxy's default HTTP format. You can
@ -6087,8 +6087,6 @@ option httplog [ clf ]
frontend, backend and server name, and of course the source address and frontend, backend and server name, and of course the source address and
ports. ports.
This option may be set either in the frontend or the backend.
Specifying only "option httplog" will automatically clear the 'clf' mode Specifying only "option httplog" will automatically clear the 'clf' mode
if it was set by default. if it was set by default.
@ -6938,7 +6936,7 @@ option tcpka
option tcplog option tcplog
Enable advanced logging of TCP connections with session state and timers Enable advanced logging of TCP connections with session state and timers
May be used in sections : defaults | frontend | listen | backend May be used in sections : defaults | frontend | listen | backend
yes | yes | yes | yes yes | yes | yes | no
Arguments : none Arguments : none
By default, the log output format is very poor, as it only contains the By default, the log output format is very poor, as it only contains the
@ -6950,8 +6948,6 @@ option tcplog
find which of the client or server disconnects or times out. For normal HTTP find which of the client or server disconnects or times out. For normal HTTP
proxies, it's better to use "option httplog" which is even more complete. proxies, it's better to use "option httplog" which is even more complete.
This option may be set either in the frontend or the backend.
"option tcplog" overrides any previous "log-format" directive. "option tcplog" overrides any previous "log-format" directive.
See also : "option httplog", and section 8 about logging. See also : "option httplog", and section 8 about logging.

View File

@ -4827,6 +4827,12 @@ stats_error_parsing:
free(curproxy->conf.lfs_file); free(curproxy->conf.lfs_file);
curproxy->conf.lfs_file = strdup(curproxy->conf.args.file); curproxy->conf.lfs_file = strdup(curproxy->conf.args.file);
curproxy->conf.lfs_line = curproxy->conf.args.line; curproxy->conf.lfs_line = curproxy->conf.args.line;
if (curproxy != &defproxy && !(curproxy->cap & PR_CAP_FE)) {
ha_warning("parsing [%s:%d] : backend '%s' : 'option httplog' directive is ignored in backends.\n",
file, linenum, curproxy->id);
err_code |= ERR_WARN;
}
} }
else if (!strcmp(args[1], "tcplog")) { else if (!strcmp(args[1], "tcplog")) {
if (curproxy->conf.logformat_string && curproxy == &defproxy) { if (curproxy->conf.logformat_string && curproxy == &defproxy) {
@ -4854,6 +4860,12 @@ stats_error_parsing:
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code)) if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
goto out; goto out;
if (curproxy != &defproxy && !(curproxy->cap & PR_CAP_FE)) {
ha_warning("parsing [%s:%d] : backend '%s' : 'option tcplog' directive is ignored in backends.\n",
file, linenum, curproxy->id);
err_code |= ERR_WARN;
}
} }
else if (!strcmp(args[1], "tcpka")) { else if (!strcmp(args[1], "tcpka")) {
/* enable TCP keep-alives on client and server streams */ /* enable TCP keep-alives on client and server streams */