mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: log: add the %Td log-format specifier
As suggested by Pavlos, it's too bad that we didn't have a %Td log format tag given that there are a few mentions of Td corresponding to the data transmission time already in the doc, so this is now done. Just like the other specifiers, we report -1 if the connection failed before reaching the data transmission state.
This commit is contained in:
parent
5e4261b0e4
commit
27b639d37f
@ -14699,6 +14699,7 @@ Please refer to the table below for currently defined variables :
|
||||
| | %ST | status_code | numeric |
|
||||
| | %T | gmt_date_time | date |
|
||||
| | %Tc | Tc | numeric |
|
||||
| | %Td | Td = Tt - (Tq + Tw + Tc + Tr) | numeric |
|
||||
| | %Tl | local_date_time | date |
|
||||
| H | %Tq | Tq | numeric |
|
||||
| H | %Tr | Tr | numeric |
|
||||
|
@ -81,6 +81,7 @@ enum {
|
||||
LOG_FMT_TW,
|
||||
LOG_FMT_TC,
|
||||
LOG_FMT_TR,
|
||||
LOG_FMT_TD,
|
||||
LOG_FMT_TT,
|
||||
LOG_FMT_STATUS,
|
||||
LOG_FMT_CCLIENT,
|
||||
|
14
src/log.c
14
src/log.c
@ -127,6 +127,7 @@ static const struct logformat_type logformat_keywords[] = {
|
||||
{ "Tl", LOG_FMT_DATELOCAL, PR_MODE_TCP, LW_INIT, NULL }, /* date local timezone */
|
||||
{ "Tq", LOG_FMT_TQ, PR_MODE_HTTP, LW_BYTES, NULL }, /* Tq */
|
||||
{ "Tr", LOG_FMT_TR, PR_MODE_HTTP, LW_BYTES, NULL }, /* Tr */
|
||||
{ "Td", LOG_FMT_TD, PR_MODE_TCP, LW_BYTES, NULL }, /* Td = Tt - (Tq + Tw + Tc + Tr) */
|
||||
{ "Ts", LOG_FMT_TS, PR_MODE_TCP, LW_INIT, NULL }, /* timestamp GMT */
|
||||
{ "Tt", LOG_FMT_TT, PR_MODE_TCP, LW_BYTES, NULL }, /* Tt */
|
||||
{ "Tw", LOG_FMT_TW, PR_MODE_TCP, LW_BYTES, NULL }, /* Tw */
|
||||
@ -1655,6 +1656,19 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
last_isspace = 0;
|
||||
break;
|
||||
|
||||
case LOG_FMT_TD: // %Td
|
||||
if (s->be->mode == PR_MODE_HTTP)
|
||||
ret = ltoa_o((s->logs.t_data >= 0) ? s->logs.t_close - s->logs.t_data : -1,
|
||||
tmplog, dst + maxsize - tmplog);
|
||||
else
|
||||
ret = ltoa_o((s->logs.t_connect >= 0) ? s->logs.t_close - s->logs.t_connect : -1,
|
||||
tmplog, dst + maxsize - tmplog);
|
||||
if (ret == NULL)
|
||||
goto out;
|
||||
tmplog = ret;
|
||||
last_isspace = 0;
|
||||
break;
|
||||
|
||||
case LOG_FMT_TT: // %Tt
|
||||
if (!(fe->to_log & LW_BYTES))
|
||||
LOGCHAR('+');
|
||||
|
Loading…
x
Reference in New Issue
Block a user