varnishlog and logging errors

Hauke Lampe lampe at hauke-lampe.de
Wed Oct 19 19:49:39 CEST 2011


On 19.10.2011 19:25, Hugo Cisneiros (Eitch) wrote:

> I use syslog to do it. When a request goes to vcl_error, I log it,
> including the status of the object for example. It's a bit more
> difficult to do (since it uses C variables, not VCL language ones),
> but works very fine.

varnish 3.x implements a syslog function via the std vmod.

|import std;
|
|vcl_error {
|  if (obj.status >= 500) {
|    std.syslog(180, "Error (" + req.url + ") (" + obj.response + ") ("
+ req.xid + ")");
|  }
|}

I couldn't find the LOG_* constants defined in the VCL scope, so I use
integer literals here.

References:
https://www.varnish-cache.org/docs/trunk/reference/vmod_std.html



Hauke.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111019/2295e985/attachment-0003.pgp>


More information about the varnish-misc mailing list