Caddy JSON log format
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.
level: log level, set toinfofor most requests, sometimeserrorts: Timestamp of thee request, format is configurablelogger: An identifier for the logger inside caddy that produced the linemsg: Always set tohandled requestrequestremote_ip: IP that the request came fromremote_port: Port number that the request came from (as string)client_ip: IP that caddy believes is the actual clientproto: HTTP protocol i.e.HTTP/1.1,HTTP/2.0,HTTP/3.0, …method: The http method used for the request i.e.GET,OPTIONS,POST,PUT,DELETE, …host: The host the request was targeted at (i.e.example.org)uri: Absolue path and query of the URI that was requested i.e./,/icon.png,/search/?q=foo, …headers: An object describing the request headerstlsresumed: nullable boolean, weather a previous tls connection was resumedversion: nullable integer, the legacy version field of the TLS-record (substract768to get the minor version)cipher_suite: nullable integer, somehow encodes the used TLS cipher suiteproto: nullable string, empty, null orhttp/1.1forHTTP/1.*,h2forHTTP/2.0andh3forHTTP/3.0server_namenullable string, the name given via SNI
bytes_read: integer, How many request body bytes were readuser_id: string, usually emptyduration: float, How long the request took in secondssize: integer: Reply size in bytesstatus: integer: HTTP status code, status code0means that the connection was closed before a reply could be sentresp_headers: Object describing the response headers
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"
]
}