I have a service based on parsing apache access logs, so I need to log there even when Vanish is turned on.

No I just simply tell Varnish to do not cache specific urls:

if (req.url ~ "(foo|bar)") 

But it's heavy on resources and it should be cached. Is there any posibility to log a request on apache access log when Varnish returns a cached copy to client?

why not just use varnishes logger up front and add to the log on varnish if it was a hit or a miss


Look at the following

  Extended variables. Supported variables are:

     Time to the first byte from the backend arrived
     Whether the request was a cache hit or miss. Pipe and pass are considered misses.
     How the request was handled, whether it was a cache hit, miss, pass, pipe or error.
     Output value set by std.log("key:value") in VCL.

By default it'll send everything to stdout.. but you can redirect it

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.