Skip to content

Instantly share code, notes, and snippets.

@cletustboone
Last active June 13, 2019 11:17
Show Gist options
  • Save cletustboone/56546e39ac7512abf14c to your computer and use it in GitHub Desktop.
Save cletustboone/56546e39ac7512abf14c to your computer and use it in GitHub Desktop.
Varnishlog Cheat Sheet

Reference Post

Requests that make it through to a specific backend

varnishlog -g request -q "Backend ~ 'api_nhl'"

Requests from a specific referrer

Client and backend varnishlog -g request -q "ReqHeader ~ 'sportsnet.ca'"

Backend only varnishlog -b -g request -q "ReqHeader ~ 'sportsnet.ca'"

Requests for a specific method

varnishlog -g request -q "ReqMethod ~ 'PUT'"

Compound Criteria

Requests where the status code is higher than 200 and the origin header matches a pattern:

varnishlog -g request -q "RespStatus> 200 and ReqHeader:Origin ~ 'foxsports.com'"

Miscellaneous

Requests to a specific backend where the request URL does or does not match a particular pattern:

varnishlog -b -g request -q 'Backend ~ "api_mlb" and BereqURL !~ "config="' | grep BereqURL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment