We are using varnish to cache different urls like:-
/discovery/v1/search
/discovery/v1/suggest
/discovery/v1/recommend
/orders/ordersearch
Right now we were able to get varnish stats like cache_hit
, cache_miss
for the overall varnish. Is there a way we can get the stats at the url level like cache_hit
, cache_miss
, etc for /discovery/v1/search
, /discovery/v1/suggest
separately?
Environment:-
I would run varnishncsa if you are not already. Add this parameter to the DAEMON_OPTS (or command line arguments) for the format:
%{Varnish:handling}x
I changed the following single line in the init.d script for varnishncsa like this:
DAEMON_OPTS="-a -w $logfile -D -P $pidfile -F \"%h %l %u %t %r %s %b %D %{VCL_Log:Referer}x [%{X-Forwarded-For}i] %{Varnish:handling}x\""
This will give you "hit", "miss" or "pass" in the handling field for each line.
Then I would post process the log-file when logrotated runs.