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] <HTTPCLIENT> <HTTPCLIENT>/<HTTPCLIENT> 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] <HTTPCLIENT> -/- 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"
This commit is contained in:
William Lallemand 2022-12-22 15:13:59 +01:00
parent a80b22eac4
commit d793ca28b6

View File

@ -39,6 +39,7 @@
#include <string.h>
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 */