diff --git a/doc/configuration.txt b/doc/configuration.txt index 58ceebbe8..66ba72c0f 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -8767,12 +8767,12 @@ Flags are : At the moment, the default HTTP format is defined this way : log-format %Ci:%Cp\ [%t]\ %f\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %st\ %B\ %cc\ \ - %cs\ %ts\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %hr\ %hs\ %{+Q}r + %cs\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %hr\ %hs\ %{+Q}r the default CLF format is defined this way : log-format %{+Q}o\ %{-Q}Ci\ -\ -\ [%T]\ %r\ %st\ %B\ \"\"\ \"\"\ %Cp\ \ - %ms\ %f\ %b\ %s\ \%Tq\ %Tw\ %Tc\ %Tr\ %Tt\ %ts\ %ac\ %fc\ \ + %ms\ %f\ %b\ %s\ \%Tq\ %Tw\ %Tc\ %Tr\ %Tt\ %tsc\ %ac\ %fc\ \ %bc\ %sc\ %rc\ %sq\ %bq\ %cc\ %cs\ \%hrl\ %hsl and the default TCP format is defined this way : @@ -8817,6 +8817,7 @@ Please refer to the table below for currently defined variables : | | %sq | srv_queue | numeric | | * | %st | status_code | numeric | | | %ts | termination_state | string | + | * | %tsc | termination_state with cookie status | string | +---+------+-----------------------------------------------+-------------+ *: mode httplog only diff --git a/include/types/log.h b/include/types/log.h index 2f11aabb7..741fba935 100644 --- a/include/types/log.h +++ b/include/types/log.h @@ -63,6 +63,7 @@ enum { LOG_CCLIENT, LOG_CSERVER, LOG_TERMSTATE, + LOG_TERMSTATE_CK, LOG_CONN, LOG_ACTCONN, LOG_FECONN, diff --git a/src/log.c b/src/log.c index bc36f694a..4ef51e1e9 100644 --- a/src/log.c +++ b/src/log.c @@ -85,6 +85,7 @@ static const struct logformat_type logformat_keywords[] = { { "cc", LOG_CCLIENT, PR_MODE_HTTP, NULL }, /* client cookie */ { "cs", LOG_CSERVER, PR_MODE_HTTP, NULL }, /* server cookie */ { "ts", LOG_TERMSTATE, PR_MODE_TCP, NULL },/* terminaison state */ + { "tsc", LOG_TERMSTATE_CK, PR_MODE_HTTP, NULL },/* terminaison state with cookie status */ { "ac", LOG_ACTCONN, PR_MODE_TCP, NULL }, /* actconn */ { "fc", LOG_FECONN, PR_MODE_TCP, NULL }, /* feconn */ { "bc", LOG_BECONN, PR_MODE_TCP, NULL }, /* beconn */ @@ -100,8 +101,8 @@ static const struct logformat_type logformat_keywords[] = { { 0, 0, 0, NULL } }; -char default_http_log_format[] = "%Ci:%Cp [%t] %f %b/%s %Tq/%Tw/%Tc/%Tr/%Tt %st %B %cc %cs %ts %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"; // default format -char clf_http_log_format[] = "%{+Q}o %{-Q}Ci - - [%T] %r %st %B \"\" \"\" %Cp %ms %f %b %s %Tq %Tw %Tc %Tr %Tt %ts %ac %fc %bc %sc %rc %sq %bq %cc %cs %hrl %hsl"; +char default_http_log_format[] = "%Ci:%Cp [%t] %f %b/%s %Tq/%Tw/%Tc/%Tr/%Tt %st %B %cc %cs %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"; // default format +char clf_http_log_format[] = "%{+Q}o %{-Q}Ci - - [%T] %r %st %B \"\" \"\" %Cp %ms %f %b %s %Tq %Tw %Tc %Tr %Tt %tsc %ac %fc %bc %sc %rc %sq %bq %cc %cs %hrl %hsl"; char default_tcp_log_format[] = "%Ci:%Cp [%t] %f %b/%s %Tw/%Tc/%Tt %B %ts %ac/%fc/%bc/%sc/%rc %sq/%bq"; char *log_format = NULL; @@ -936,13 +937,17 @@ void sess_log(struct session *s) break; case LOG_TERMSTATE: // %ts - LOGCHAR(sess_term_cond[(s->flags & SN_ERR_MASK) >> SN_ERR_SHIFT]); LOGCHAR(sess_fin_state[(s->flags & SN_FINST_MASK) >> SN_FINST_SHIFT]); - if (fe->mode == PR_MODE_HTTP) { - LOGCHAR((be->options & PR_O_COOK_ANY) ? sess_cookie[(txn->flags & TX_CK_MASK) >> TX_CK_SHIFT] : '-'); - LOGCHAR((be->options & PR_O_COOK_ANY) ? sess_set_cookie[(txn->flags & TX_SCK_MASK) >> TX_SCK_SHIFT] : '-'); - } + *tmplog = '\0'; + last_isspace = 0; + break; + + case LOG_TERMSTATE_CK: // %tsc, same as TS with cookie state (for mode HTTP) + LOGCHAR(sess_term_cond[(s->flags & SN_ERR_MASK) >> SN_ERR_SHIFT]); + LOGCHAR(sess_fin_state[(s->flags & SN_FINST_MASK) >> SN_FINST_SHIFT]); + LOGCHAR((be->options & PR_O_COOK_ANY) ? sess_cookie[(txn->flags & TX_CK_MASK) >> TX_CK_SHIFT] : '-'); + LOGCHAR((be->options & PR_O_COOK_ANY) ? sess_set_cookie[(txn->flags & TX_SCK_MASK) >> TX_SCK_SHIFT] : '-'); *tmplog = '\0'; last_isspace = 0; break;