If you are running on your server multiple domains and content is cached through Varnish, often you need to identify in real time who is generating highest traffic.
Here are some varnish 4.x commands we use to identify accounts with highest traffic:
1. Sorted list of hostnames with highest number of requests:
varnishtop -C -I ReqHeader:Host
Output could look like this:
2. Another common task is to find the most frequently executed URL:
varnishtop -i ReqURL
Here is example of output:
3. If you need to sort requests by any header value (e.g. in our case by User-Agent header):
varnishtop -C -I ReqHeader:User-Agent
Output could look like this: