From: Frédéric Lécaille Date: Tue, 5 Nov 2019 08:57:45 +0000 (+0100) Subject: MINOR: peers: Add "log" directive to "peers" section. X-Git-Tag: v2.1-dev5~39 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/postgres_fdw.c?a=commitdiff_plain;h=b6f759b43d1a6d8baa2394c275d6de277be15e84;p=haproxy.git MINOR: peers: Add "log" directive to "peers" section. This patch is easy to review: let's call parse_logsrv() function to parse "log" directive as this is already for other sections for proxies. This enable us to log incoming TCP connections for the listeners for "peers" sections. Update the documentation for "peers" section. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 0bb7313cd..beb2726e7 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -2138,6 +2138,12 @@ default-server [param*] enable This re-enables a disabled peers section which was previously disabled. +log
[len ] [format ] [sample :] + [ []] + "peers" sections support the same "log" keyword as for the proxies to + log information about the "peers" listener. See "log" option for proxies for + more details. + peer : [param*] Defines a peer inside a peers section. If is set to the local peer name (by default hostname, or forced diff --git a/src/cfgparse.c b/src/cfgparse.c index eaad6c2cd..2e200e885 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -714,6 +714,17 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) } err_code |= parse_server(file, linenum, args, curpeers->peers_fe, NULL, 0); } + else if (strcmp(args[0], "log") == 0) { + if (init_peers_frontend(file, linenum, NULL, curpeers) != 0) { + err_code |= ERR_ALERT | ERR_ABORT; + goto out; + } + if (!parse_logsrv(args, &curpeers->peers_fe->logsrvs, (kwm == KWM_NO), &errmsg)) { + ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + } else if (strcmp(args[0], "peers") == 0) { /* new peers section */ /* Initialize these static variables when entering a new "peers" section*/ bind_line = peer_line = 0;