logging errors in varnish 4

Andreas Plesner apj at mutt.dk
Tue Aug 4 07:59:31 CEST 2015


On Mon, Aug 03, 2015 at 06:16:17PM -0400, Jason Price wrote:

> In varnish 3, I did the following to log odd errors to syslog:
> 
>         std.syslog((3*8)+5, "returning backend error page. client.ip is " +
> client.ip +
>                " req.xid is " + req.xid +
[...]
> Am I missing something?

You're right that client is not accessible in backend functions (for IMS there
may not even be a client), however bereq.* should be a fine replacement for
req.*.
You could also just put the log in the client side of things, i.e. in
vcl_deliver, where you have access to req.* and client.*

Also, syslog is a poor choice performance-wise. The correct solution is, and
has always been, to monitor the shared memory log.

-- 
Andreas



More information about the varnish-misc mailing list