Skip to content

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/caddy
LOGPARSER_LOG_PATHS=/var/log/access/access.log

The 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_proxies under servers in Caddy’s global options. Caddy then resolves the visitor’s address into the logged client_ip, which is the field GeoMetrikks reads (falling back to remote_ip on logs from Caddy older than 2.7). Without it the log carries the proxy’s address and the map shows the proxy. See docs/proxy-setup.md.
  • Keep the json encoder’s time_format at its default or any ISO variant, and duration_format at its default. Lines with wall, common_log or custom time layouts are skipped, and a non-default duration_format loses request times. The appended upstream_duration_ms field always uses milliseconds.