Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Varnishlog: show the hash() data in output

The post Varnishlog: show the hash() data in output appeared first on ma.ttias.be.

Since Varnish 4.x and later, the default varnishlog output doesn't show the vcl_hash() data anymore.

Your varnishlog will look like this:

-   VCL_call       HASH
-   VCL_return     lookup
-   Hit            103841868
-   VCL_call       HIT
-   VCL_return     deliver

If you're debugging, this isn't very useful.

To include the "old" behaviour of Varnish and add all the hash elements as well, start Varnish with the following extra parameter:

 -p vsl_mask=+Hash

After a Varnish restart, this will procedure varnishlog output like this:

-   VCL_call       HASH
-   Hash           "/images/path/to/file.jpg%00"
-   Hash           "http%00"
-   Hash           "www.yoursite.tld%00"
-   Hash           "/images/path/to/file.jpg%00"
-   Hash           "www.yoursite.tld%00"
-   VCL_return     lookup
-   VCL_call       MISS

In this example, the hash included:

hash_data(req.url);
hash_data(req.http.X-Forwarded-Proto);
hash_data(req.http.host);
hash_data(req.http.Cookie);

The %00 are null characters to prevent cache-conflicts in case you have hash('123'); hash('456); vs. hash('1'); hash('23456');.

The post Varnishlog: show the hash() data in output appeared first on ma.ttias.be.



This post first appeared on Ma.ttias.be ~ The Web, Open Source, PHP, Security,, please read the originial post: here

Share the post

Varnishlog: show the hash() data in output

×

Subscribe to Ma.ttias.be ~ The Web, Open Source, Php, Security,

Get updates delivered right to your inbox!

Thank you for your subscription

×