Reputation: 8977
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?
Upvotes: 6
Views: 3658
Reputation: 496
You can usually see it with the varnishlog
command.
However, since varnish 5 you need to enable the hash specifically in the log output. This can be done with the varnishadm
utility:
Execute varnishadm
and on the prompt it starts, type:
varnish> param.set vsl_mask +Hash
you can exit the shell by typing quit
, and then run varnishlog
again, it should display the hash used on each request now.
Upvotes: 11
Reputation: 1678
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
Upvotes: 1