sub vcl_hash {
hash_data(req.http.Host + req.url);
}
This is my varnish vcl_hash . Can someone enlighten me with configuration to log the cache key. so that I can verify what's the key being set.
I'm using varnish -6.6.1 version.
sub vcl_hash {
hash_data(req.http.Host + req.url);
}
This is my varnish vcl_hash . Can someone enlighten me with configuration to log the cache key. so that I can verify what's the key being set.
I'm using varnish -6.6.1 version.
Copyright © 2021 Jogjafile Inc.
The built-in VCL behavior combines the URL and the
Hostheader to compose the cache key. The implementation is slightly different from your example.If you use a tool like
varnishlogto inspect the Varnish logs, the cache key is not included in the output by default. You can unlock this using the vsl_mask runtime parameter.If you're only planning to temporarily visualize the hash, you can use the following command to enable it without persisting the setting:
If you want to ensure the hash is always part of the VSL output, please edit your
varnishdruntime configuration and add-p vsl_mask=+Hash.Once the VSL mask is set, you can run the following command to test this:
This command will return the logs for all transactions, but will only include the
ReqURLtag, theReqHeadertag for theHostheader and the correspondingHashtags.Here's an example of what that could like like for
http://localhost/: