Is there a way to list the contents of the varnish cache storage? Also, it would be nice to somehow list the most frequent cache hits.

I found a way to see the most frequent cache misses by listing what is being sent to the backend with:

varnishtop -b -i TxURL

It would be very useful to see what are my top cache hits URLs.


This answer was originally posted on stackoverflow, and I think it is quite helpful: https://stackoverflow.com/questions/14214104/list-contents-of-varnish-cache

You can use the parameter "Varnish:hitmiss" of varnishncsa.

First capture a sample of logs with:

varnishncsa -F '%U%q %{Varnish:hitmiss}x' -n NAME -w /path/requests.logs

and then:

sort -k 1 /path/requests.logs | uniq -c | sort -k 1 -n -r | head -25

  • Soemthing is wrong with this answer. THis command gives me varnishncsa: invalid option -- 'F' Mar 18 '13 at 17:47

There's no way of listing the contents of the cache.

You can get the list of top requested URLs with

varnishtop -i RxURL

but there's no easy way to tell from that which are cache HITs and MISSes. There is a script here which may help you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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