Configuration
How the tool itself is configured. For how to connect to each log source, see Log Sources.
Config file — where it lives
Two locations, first hit wins:
| Path | Scope |
|---|---|
./caddy-analyzer.json | Local (project) |
~/.config/caddy-analyzer/config.json | Global (XDG) |
~/.config follows XDG_CONFIG_HOME if set, else os.UserConfigDir(). Dirs are created 0750, files 0600.
Schema
{
"source": "docker://caddy",
"namespace": "production",
"blocklist": {
"no_defaults": false,
"custom_sources": [{ "name": "My List", "url": "https://example.com/list.txt" }],
"remove_sources": ["tor-exit-nodes"]
},
"tuning": {
"geo_cache_ttl": "24h",
"geo_cache_size": 50000,
"iptables_timeout": "10s"
}
}
Manage it
caddy-analyze config # show active file + source
caddy-analyze config /var/log/caddy/access.log # set local
caddy-analyze config docker://caddy --global # set global
caddy-analyze config k8s://caddy-xxx -n production # with namespace
caddy-analyze config reset # remove local
caddy-analyze config reset --global # remove global
caddy-analyze blocklist init # persist blocklist flags to config
caddy-analyze whitelist --init # persist never-block to /etc/caddy-analyzer/whitelist.txt
blocklist init writes current --no-default-blocklists / --blocklist-config / --blocklist-remove into the same file so guard picks them up without CLI flags.
Tuning — precedence
Config file values are defaults; CLI flags override when explicitly set. The three tunables:
| Key | Config field | CLI flag | Default |
|---|---|---|---|
| GeoIP cache TTL | tuning.geo_cache_ttl | --geo-cache-ttl 24h | 24h (0 = off, slow) |
| GeoIP cache size | tuning.geo_cache_size | --geo-cache-size 50000 | 50000 |
| iptables timeout | tuning.iptables_timeout | --iptables-timeout 10s | 10s |
# example: keep GeoIP results longer on a busy host
caddy-analyze --geo-cache-ttl 48h --geo-cache-size 100000 /var/log/caddy/access.log
Environment & XDG
| Variable | Affects |
|---|---|
XDG_CONFIG_HOME | Global config dir (~/.config/caddy-analyzer) |
HOME | Fallback for config/cache |
https_proxy / http_proxy | Blocklist fetches and GeoIP auto-download |
Caches & state (not config)
| Path | What |
|---|---|
~/.cache/caddy-analyzer/blocklists/ | Blocklist CIDRs (7d TTL) |
~/.config/caddy-analyzer/GeoLite2-*.mmdb | GeoIP (auto-download from P3TERX mirror) |
/var/lib/caddy-analyzer/blocked.json | Guard blocked IPs (survives restart) |
/var/log/caddy-analyzer-audit.jsonl | Audit log (0600, JSON lines) |
/etc/caddy-analyzer/whitelist.txt | Never-block list (CIDRs, # comments) |
Override with flags: --cache-dir, --geoip-db, --state-file, --audit-log, --never-block-file.
Resolution order (no source arg)
./caddy-analyzer.json→~/.config/…/config.json- Stdin pipe if data is piped
- 5 candidates:
./access.log,./caddy.log,./caddy-access.log,/var/log/caddy/access.log,/var/log/caddy/caddy.log