I'm using varnishncsa to log requests that are taking to long to be answered on my backend servers using the following command:
varnishncsa -F '%t "%r" %s %T' | awk '$7 > 10 {print}'
I was trying to add information on the backend name but this is not being displayed on varnishncsa output:
sub vcl_backend_response {
std.log("backend_name:" + beresp.backend.name);
}
what I'm doing wrong?
It doesn't work for you because
varnishncsa
uses "client" mode by default. Enable it using-b
switch.Subsequently, this will work:
You might want to check full explanation which includes additional optimization to query slow backend requests.