Varnish logging and preventing crossed session issue

Published 28 Dec 2016

Just a quick note to log the Varnish logging

Manual: varnishncsa

nohup varnishncsa -F "%{Set-Cookie}o %U %{Varnish:handling}x" | grep --line-buffered "frontend=" >> varnish.out &

My current requirement is to monitor all the Set-Cookie header being returned from Varnish since it’ll contain the user’s session.

Ideally, the user session should only be set for certain route, hence the monitor is to identify any potential problems of cross-session.

I also learnt that without --line-buffered option for grep, the piping to output file just doesn’t seem to work.