Varnish Enterprise

JSON Logging

Varnish 6.0


Both varnishlog and varnishncsa support JSON output. This is done via the line delimited JSON format, LDJSON, which uses the newline character to separate valid JSON objects.


To output LDJSON from varnishlog you add the -S argument to the varnishlog command. For example:

varnishlog -g request -S


varnishncsa uses the -j argument make sure all variables are JSON safe. For proper JSON support the format string should be a valid JSON object. For example:

varnishncsa -j -F '{ "received_at": "%t", "response_bytes": %b, "request_bytes": %I, "time_taken": %D, "first_line": "%r", "status": %s }'