[master] e171090 Add a SLT_BackendStart log tag, and log address and port on backend req
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Mon Apr 25 15:57:06 CEST 2016
commit e171090e7fc84ced76a5aeae822b9d11b59ee803
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Mon Apr 25 11:26:49 2016 +0200
Add a SLT_BackendStart log tag, and log address and port on backend req
This log record is a counterpart to the SLT_ReqStart for backends, and
shows the socket endpoint we are talking to at the start of backend
requests. Today this information is only logged on opening a backend
connection (SLT_BackendOpen), and is thus not available on the backend
log transaction when on a reused backend connection.
We need this information to complete the backend view varnishncsa
extension.
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index 6fd5f64..1cf127c 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -80,6 +80,8 @@ V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr,
ssize_t i;
struct http_conn *htc;
int do_chunked = 0;
+ char abuf[VTCP_ADDRBUFSIZE];
+ char pbuf[VTCP_PORTBUFSIZE];
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
@@ -95,6 +97,9 @@ V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr,
do_chunked = 1;
}
+ VTCP_hisname(htc->fd, abuf, sizeof abuf, pbuf, sizeof pbuf);
+ VSLb(bo->vsl, SLT_BackendStart, "%s %s", abuf, pbuf);
+
(void)VTCP_blocking(htc->fd); /* XXX: we should timeout instead */
V1L_Reserve(wrk, wrk->aws, &htc->fd, bo->vsl, bo->t_prev);
*ctr += HTTP1_Write(wrk, hp, HTTP1_Req);
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index e1c946d..26d8216 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -522,5 +522,16 @@ SLTM(Witness, 0, "Lock order witness records",
"Diagnostic recording of locking order.\n"
)
+SLTM(BackendStart, 0, "Backend request start",
+ "Start of backend processing. Logs the backend IP address and port"
+ " number.\n\n"
+ "The format is::\n\n"
+ "\t%s %s\n"
+ "\t| |\n"
+ "\t| +- Backend Port number\n"
+ "\t+---- Backend IP4/6 address\n"
+ "\n"
+)
+
#undef NODEF_NOTICE
/*lint -restore */
More information about the varnish-commit
mailing list