From d793ca28b6d4210f05bd81caba55b371ef5248df Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Thu, 22 Dec 2022 15:13:59 +0100 Subject: [PATCH] MEDIUM: httpclient: change the default log format to skip duplicate proxy data The httpclient emits logs in the httplog format, however it still display the frontend, the backend and the server. In the case of the httpclient we only need to know that we are using the httpclient, so the backend and server information are irelevant. In the case of extra code the name of the proxy can be long and will be displayed twice which is not useful. This is the same log-format as the httplog but the %b/%s is now -/- so the format is still compatible with an httplog parser. Before: <134>Dec 22 15:19:27 haproxy[1013520]: -:- [22/Dec/2022:15:19:27.482] / 2/0/4/6/10 200 848 - - ---- 0/0/0/0/0 0/0 {92.123.236.161} "GET http://r3.o.lencr.org/1234 HTTP/1.1" After: <134>Dec 22 15:19:27 haproxy[1013520]: -:- [22/Dec/2022:15:19:27.482] -/- 2/0/4/6/10 200 848 - - ---- 0/0/0/0/0 0/0 {92.123.236.161} "GET http://r3.o.lencr.org/1234 HTTP/1.1" --- src/http_client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/http_client.c b/src/http_client.c index bd398237e..338bab31a 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -39,6 +39,7 @@ #include +static char httpclient_log_format[] = "%ci:%cp [%tr] %ft -/- %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"; static struct proxy *httpclient_proxy; @@ -1214,7 +1215,7 @@ struct proxy *httpclient_create_proxy(const char *id) px->conn_retries = CONN_RETRIES; px->timeout.client = TICK_ETERNITY; /* The HTTP Client use the "option httplog" with the global log server */ - px->conf.logformat_string = default_http_log_format; + px->conf.logformat_string = httpclient_log_format; px->http_needed = 1; /* clear HTTP server */