MINOR: log: add a tag for amount of bytes uploaded from client to server

For POST, PUT, CONNECT or tunnelled connections, it's annoying not to have
the amount of uploaded bytes in the logs. %U now reports this value.
This commit is contained in:
Willy Tarreau 2012-12-20 15:38:04 +01:00
parent 05ed29cf6e
commit c5259fdc57
3 changed files with 14 additions and 1 deletions

View File

@ -10272,6 +10272,7 @@ Please refer to the table below for currently defined variables :
| | %Ts | timestamp | numeric |
| | %Tt | Tt | numeric |
| | %Tw | Tw | numeric |
| | %U | bytes_uploaded (from client to server) | numeric |
| | %ac | actconn | numeric |
| | %b | backend_name | string |
| | %bc | beconn | numeric |

View File

@ -65,6 +65,7 @@ enum {
LOG_FMT_BACKEND,
LOG_FMT_SERVER,
LOG_FMT_BYTES,
LOG_FMT_BYTES_UP,
LOG_FMT_T,
LOG_FMT_TQ,
LOG_FMT_TW,

View File

@ -87,7 +87,8 @@ static const struct logformat_type logformat_keywords[] = {
{ "ft", LOG_FMT_FRONTEND_XPRT, PR_MODE_TCP, LW_INIT, NULL }, /* frontend with transport mode */
{ "b", LOG_FMT_BACKEND, PR_MODE_TCP, LW_INIT, NULL }, /* backend */
{ "s", LOG_FMT_SERVER, PR_MODE_TCP, LW_SVID, NULL }, /* server */
{ "B", LOG_FMT_BYTES, PR_MODE_TCP, LW_BYTES, NULL }, /* bytes read */
{ "B", LOG_FMT_BYTES, PR_MODE_TCP, LW_BYTES, NULL }, /* bytes from server to client */
{ "U", LOG_FMT_BYTES_UP, PR_MODE_TCP, LW_BYTES, NULL }, /* bytes from client to server */
{ "Tq", LOG_FMT_TQ, PR_MODE_HTTP, LW_BYTES, NULL }, /* Tq */
{ "Tw", LOG_FMT_TW, PR_MODE_TCP, LW_BYTES, NULL }, /* Tw */
{ "Tc", LOG_FMT_TC, PR_MODE_TCP, LW_BYTES, NULL }, /* Tc */
@ -1117,6 +1118,16 @@ int build_logline(struct session *s, char *dst, size_t maxsize, struct list *lis
last_isspace = 0;
break;
case LOG_FMT_BYTES_UP: // %U
if (!(tolog & LW_BYTES))
LOGCHAR('+');
ret = lltoa(s->logs.bytes_in, tmplog, dst + maxsize - tmplog);
if (ret == NULL)
goto out;
tmplog = ret;
last_isspace = 0;
break;
case LOG_FMT_CCLIENT: // %cc
src = txn->cli_cookie;
ret = lf_text(tmplog, src, dst + maxsize - tmplog, tmp);