Search
Varnish Enterprise

JSON Logging

Varnish 6.0

Description

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.

varnishlog

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

varnishlog -g request -S

varnishncsa

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 }'

®Varnish Software, Wallingatan 12, 111 60 Stockholm, Organization nr. 556805-6203