Varnish Cache offers several ways to log and most of the documentation is related to varnishlog which includes several information related to request, response and backend response. Now what’s happen if we need to log our own variables or message to a file?
then you can easily add into your VCL the following line:
std.syslog(180, "log description");
The first parameter, 180, is the priority value. If you want to add some variables to your log message:
std.syslog(180, "log description" + beresp.ttl);
This will logo the message to general system log, which is often, in a Linux system, is located in /var/log/messages.