]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: httpclient: add an "https" log-format
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 23 Apr 2025 13:32:46 +0000 (15:32 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 23 Apr 2025 13:32:46 +0000 (15:32 +0200)
Add an experimental "https" log-format for the httpclient, it is not
used by the httpclient by default, but could be define in a customized
proxy.

The string is basically a httpslog, with some of the fields replaced by
their backend equivalent or - when not available:

"%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 %[bc_err]/%[ssl_bc_err,hex]/-/-/%[ssl_bc_is_resumed] -/-/-"

include/haproxy/log.h
src/log.c

index ff69f7b0ef25549922ebf7f8caa59bf4faabe217..aec00e6ab3a94abe1a5f45031d34fa83c4ba6b91 100644 (file)
@@ -36,6 +36,7 @@ extern struct pool_head *pool_head_uniqueid;
 extern const char *log_levels[];
 extern char *log_format;
 extern char httpclient_log_format[];
+extern char httpsclient_log_format[];
 extern char default_tcp_log_format[];
 extern char clf_tcp_log_format[];
 extern char default_http_log_format[];
index 40bf0f64bb86716d5236cb6e33c25d57468e01fe..9ca61985605fddc7a0b53b09238fb30894cd6afc 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -326,6 +326,7 @@ static const struct logformat_alias logformat_aliases[] = {
 };
 
 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";
+char httpsclient_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 %[bc_err]/%[ssl_bc_err,hex]/-/-/%[ssl_bc_is_resumed] -/-/-";
 char default_http_log_format[] = "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"; // default format
 char default_https_log_format[] = "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r %[fc_err]/%[ssl_fc_err,hex]/%[ssl_c_err]/%[ssl_c_ca_err]/%[ssl_fc_is_resumed] %[ssl_fc_sni]/%sslv/%sslc";
 char clf_http_log_format[] = "%{+Q}o %{-Q}ci - - [%trg] %r %ST %B \"\" \"\" %cp %ms %ft %b %s %TR %Tw %Tc %Tr %Ta %tsc %ac %fc %bc %sc %rc %sq %bq %CC %CS %hrl %hsl";
@@ -344,6 +345,7 @@ char default_rfc5424_sd_log_format[] = "- ";
 static inline int logformat_str_isdefault(const char *str)
 {
        return str == httpclient_log_format ||
+              str == httpsclient_log_format ||
               str == default_http_log_format ||
               str == default_https_log_format ||
               str == clf_http_log_format ||