Search code examples
varnishvarnish-vcl

How can I view the contents of Varnish's hash_data()?


I know that in Varnish you can add data to the cache hash using hash_data() within vcl_hash, as per the docs.

For debugging purposes, I would like to be able to see the entire contents of whatever is making up the hash.

For example, it would be really useful if we could do:

 # This won't work:
 set req.http.X-DEBUG = "HASH-DATA:" + hash_data();

Does anyone know if this is possible?


Solution

  • varnishlog properly explains what hash data is used for a specific request.

    You can redirect the varnishlog output to your custom file for further review:

    varnishlog > my-log.log