Caddy
GeoMetrikks parses Caddy’s native JSON access logs. Caddy logs to stderr
by default, so give the site (or a wildcard site block) a log directive
that writes to a file:
(log_settings) { log { output file /var/log/caddy/access.log format json level INFO } log_append upstream_duration_ms {rp.upstream.duration_ms} }
app.example.com { import log_settings reverse_proxy app:8000 }The optional log_append line populates the Upstream res time column in
Access Logs and the Upstream response field in the selected request’s
details panel. Without it, the column shows - and the detail field reads
Not recorded. Caddy’s measurement includes writing the response body to
the client, so it is not exactly equivalent to nginx’s
$upstream_response_time.
Mount the log directory into the GeoMetrikks container and point the parser at it:
ACCESS_LOG_DIR=/var/log/caddyLOGPARSER_LOG_PATHS=/var/log/access/access.logThe format is auto-detected per file; set LOGPARSER_LOG_FORMATS=caddy-json
to pin it. Notes:
- Caddy rotates the log file itself by default; GeoMetrikks follows the rotation.
- Behind a CDN or another proxy, set
trusted_proxiesunderserversin Caddy’s global options. Caddy then resolves the visitor’s address into the loggedclient_ip, which is the field GeoMetrikks reads (falling back toremote_ipon logs from Caddy older than 2.7). Without it the log carries the proxy’s address and the map shows the proxy. Seedocs/proxy-setup.md. - Keep the json encoder’s
time_formatat its default or any ISO variant, andduration_formatat its default. Lines withwall,common_logor custom time layouts are skipped, and a non-defaultduration_formatloses request times. The appendedupstream_duration_msfield always uses milliseconds.