Make the resolver pure DNS: JSON access log on stdout instead of a log store
The resolver kept its own query-log store (a bbolt ring, a live ring with SSE fanout, rolling per-domain counters and dashboard time-series) for the console. In a multi-node deployment each pod held a different slice of that, so every view disagreed with itself, and the cost sat on the query path. Charts belong in Grafana and log search in the log collector, so the store is gone. internal/accesslog writes one JSON line per notable query to stdout. The default is what was blocked and what failed (blocked, redirected, SERVFAIL, dropped, refused); log_cached and sample_rate add ordinary answers for a debugging session. Lines go through a bounded buffer to a single writer goroutine and are dropped, and counted in fancydns_access_log_dropped_total, when the stream cannot keep up, so a stalled log pipe can never stall a query. The config key is access_log (the old qlog block is ignored, like any unknown key). The metrics gain what the dashboard used to compute: fancydns_group_queries_total by ACL group and outcome and fancydns_responses_total by RCODE. Removed with the store: /api/dashboard, /api/logs, /api/logs/stream, /api/logs/clear, /api/cache/top, the series rings, and the cache's per-name hit table, which took a mutex and built a string on every cache hit. Tests that read the old log now read the access-log lines; the contract test drops the removed endpoints. The web console still calls them and is changed in the next commit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dd1117fd91
commit
c6c5ca4ff7
31 files changed
+818
-3389
No files matched your search
+11
-13
@@ -161,20 +161,18 @@ acl:
|
||||
cidrs: ["192.168.91.0/24"]
|
||||
policy: deny
|
||||
|
||||
qlog:
|
||||
# One JSON line on stdout per query worth looking at, for whatever collects the
|
||||
# pod's logs (Loki, a Grafana agent, `kubectl logs`). Nothing is stored here;
|
||||
# the metrics count everything. The default is blocked queries and failures.
|
||||
access_log:
|
||||
enabled: true
|
||||
path: data/queries.db
|
||||
max_entries: 200000
|
||||
flush_interval: 1s
|
||||
# 1.0 logs every query. Lower it on a busy instance: the per-domain
|
||||
# counters are what the dashboard actually needs.
|
||||
sample_rate: 1.0
|
||||
log_blocked: true
|
||||
log_cached: false
|
||||
log_errors: true
|
||||
live_buffer: 2000
|
||||
top_domains: 5000
|
||||
top_ttl: 5m
|
||||
log_blocked: true # blocklist hits and redirects
|
||||
log_errors: true # SERVFAIL, drops, ACL refusals
|
||||
log_cached: false # also cache hits
|
||||
# Fraction of ordinary answers to log as well: 0 none, 1 all. For a short
|
||||
# debugging session; leave at 0 otherwise.
|
||||
sample_rate: 0
|
||||
buffer: 4096 # lines that may wait for the log stream before dropping
|
||||
|
||||
cluster:
|
||||
enabled: false
|
||||
|
||||
Reference in new issue
Block a user