Commit 68b7bfea authored by Tollef Fog Heen's avatar Tollef Fog Heen

Add hitmiss and handling formats to varnishncsa

Make it possible to add a hit/miss item to varnishncsa as well as a
hit/miss/pass/pipe item.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5549 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 7c6c3b22
......@@ -102,6 +102,7 @@ static struct logline {
char *df_u; /* %u, Remote user */
char *df_ttfb; /* Time to first byte */
const char *df_hitmiss; /* Whether this is a hit or miss */
const char *df_handling; /* How the request was handled (hit/miss/pass/pipe) */
int active; /* Is log line in an active trans */
int complete; /* Is log line complete */
int matched; /* Did log line match */
......@@ -429,6 +430,24 @@ collect_client(struct logline *lp, enum vsl_tag tag, unsigned spec,
lp->df_Host = trimline(next, end);
break;
case SLT_VCL_call:
if(!lp->active)
break;
if (strncmp(ptr, "hit", len) == 0) {
lp->df_hitmiss = "hit";
lp->df_handling = "hit";
} else if (strncmp(ptr, "miss", len) == 0) {
lp->df_hitmiss = "miss";
lp->df_handling = "miss";
} else if (strncmp(ptr, "pass", len) == 0) {
lp->df_hitmiss = "miss";
lp->df_handling = "pass";
} else if (strncmp(ptr, "pipe", len) == 0) {
lp->df_hitmiss = "miss";
lp->df_handling = "pipe";
}
break;
case SLT_Length:
if (!lp->active)
break;
......@@ -647,6 +666,14 @@ h_ncsa(void *priv, enum vsl_tag tag, unsigned fd,
fprintf(fo, "%s", lp->df_ttfb);
p += 9+15;
break;
} else if (strncmp(what, "hitmiss}x", 9) == 0) {
fprintf(fo, "%s", lp->df_hitmiss);
p += 9+8;
break;
} else if (strncmp(what, "handling}x", 10) == 0) {
fprintf(fo, "%s", lp->df_handling);
p += 9+9;
break;
}
}
/* Fall through if we haven't handled something */
......
......@@ -96,6 +96,14 @@ The following options are available:
Varnish:time_firstbyte
Time to the first byte from the backend arrived
Varnish:hitmiss
Whether the request was a cache hit or miss. Pipe
and pass are considered misses.
Varnish:handling
How the request was handled, whether it was a
cache hit, miss, pass or pipe.
-o Filter log output to request groups that match a regular
expression on a specified tag.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment