Logging hit only in varnishncsa

Rowan @ Jetboy rowan at jetboy.co.uk
Tue Jun 19 01:03:38 CEST 2012


Varnish 3.0.2 / Ubuntu 12.04 Server x64

 

With Varnish sitting in front of Apache, am I right in saying that requests
served from Varnish's cache will not get logged by Apache, and anything not
served by Varnish will get logged both in Apache's logs and varnishncsa?

 

If so, I'd like to only log Varnish hits in varnishncsa so I'm not double
counting, as my intent is to aggregate all the logs for analysis. I can
record whether it's a hit or a miss in Varnish's log by adding
%{Varnish:hitmiss}x to the end of the log format. I was hoping to strip
misses out with -X .*miss$ but it isn't working, and wouldn't be very
elegant if it did. How do I get this working, or is there a better way?

 

Ubuntu shows that varnishncsa has a [-i tag] argument, but this isn't listed
in https://www.varnish-cache.org/docs/trunk/reference/varnishncsa.html I get
back "-i is not valid for varnishncsa" regardless of what I try.

 

https://www.varnish-cache.org/trac/ticket/646 suggests that there's an -o
argument for this, but attempts with this return "invalid option -- 'o'"

 

 

/etc/init.d/varnishncsa changes:

 

LOG_FORMAT="%{Host}i %h %l %u %t \"%r\" %s %b \"%{Referer}i\"
\"%{User-agent}i\" %{Varnish:hitmiss}x"

DAEMON_OPTS="-a -c -D -P ${PIDFILE} -w
/var/log/varnish/hollywood.varnish.log -X .*miss$"

 

--chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} -F "${LOG_FORMAT}" \

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120619/ba3f85fc/attachment-0001.html>


More information about the varnish-misc mailing list