Caddy JSON log format

Date: — Topic: — by Slatian

How the default JSON access log format of the Caddy webserver is structured

The Access log Format

The access logs are written as text files with one independent JSON object per line for each request.

Headers

Header names are always writte in Kebab-Title-Case i.e. User-Agent.

Header names always map to an array of values as it is possible that each header could be duplicated (sometimes intentional, sometimes not).

Some headers like Authorization always have the placeholder value REDACTED, caddy does this automatically by default.

Example:

"headers": {
	"Content-Length": [
		"227"
	],
	"User-Agent": [
		"Synapse/1.149.1"
	],
	"Content-Type": [
		"application/json"
	],
	"Authorization": [
		"REDACTED"
	]
}