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.
diff --git a/doc/configuration.txt b/doc/configuration.txt
index 596ca47..d70c9d8 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -10272,6 +10272,7 @@
| | %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 |
diff --git a/include/types/log.h b/include/types/log.h
index ce0c717..c81ab0d 100644
--- a/include/types/log.h
+++ b/include/types/log.h
@@ -65,6 +65,7 @@
LOG_FMT_BACKEND,
LOG_FMT_SERVER,
LOG_FMT_BYTES,
+ LOG_FMT_BYTES_UP,
LOG_FMT_T,
LOG_FMT_TQ,
LOG_FMT_TW,
diff --git a/src/log.c b/src/log.c
index 24273a5..7483842 100644
--- a/src/log.c
+++ b/src/log.c
@@ -87,7 +87,8 @@
{ "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 @@
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);