Last active
September 13, 2024 15:57
-
-
Save cupracer/54f496a54b6ce65576b718be602f5d21 to your computer and use it in GitHub Desktop.
varnishlog examples (version 4.x)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# filter by request host header | |
varnishlog -q 'ReqHeader ~ "Host: example.com"' | |
# filter by request url | |
varnishlog -q 'ReqURL ~ "^/some/path/"' | |
# filter by client ip (behind reverse proxy) | |
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"' | |
# filter by request host header and show request url and referrer header | |
varnishlog -q 'ReqHeader ~ "Host: (www\.)?example\.com"' -i "ReqURL" -I "ReqHeader:Referer:" | |
# filter for permanent redirects and show request host/url and new location | |
varnishlog -q "RespStatus ~ 301" -i "ReqURL" -I "ReqHeader:Host:" -I "RespHeader:Location:" -i "RespStatus" | |
# filter for permanent and temporary redirects and filter for Location "http://s3" to | |
# just show (for example) redirects to something on an Amazon S3 bucket | |
varnishlog -q '(RespStatus ~ 301 or RespStatus ~307) and RespHeader ~ "Location: https://s3"' \ | |
-i "ReqURL" -I "ReqHeader:Host:" -I "RespHeader:Location:" -i "RespStatus" -I "ReqHeader:Referer:" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice!