Wednesday, November 19, 2014

How to monitor HTTP headers in near real-time

Unix has many tools that you can stitch together to do useful things.

For example, if you want to watch your site headers in near real-time you can use watch and curl.

You might want to do that if you need to build information headers (like X-Cache-Info) and you want to quickly try out different ideas.

In my case I use it during a patch window to monitor when our site's proxy server has changed so that the (now inactive) proxy can have updates applied.

The command that you run in a terminal is:

watch "curl -I -s www.example.com"

-I is headers only, while -s is silent. It'll print the headers every two seconds by default. If you want to update every second it is:



watch -n 1 "curl -I -s www.example.com"

No comments: