Repository navigation
Description
What happens
Every 10 minutes, loki.source.docker re-sends the last log line of any container that has written nothing in those 10 minutes. Loki stores each copy as a duplicate for 7 days. After that, Loki rejects each copy as too old, and Alloy counts it in loki_write_dropped_entries_total{reason="ingester_error"}. The re-sends never stop until the container writes a new line or is recreated.
Evidence (fenrir, 2026-11-17, read-only)
sensor-zeeklast wrote to stdout on 2026-11-09 06:26:34: Zeek's GeoIP error from the SSH geo-data policy, explained in docs(sensor): record fenrir's 18-day blind spot, explain the GeoIP error, fix the checkout path #1523.- In the last 26 hours, Alloy logged
could not transfer logs ... written=0155 times for that container, about once every 10 minutes. The two busy containers on the host logged it at most 5 times. - From 2026-11-16 06:26, exactly 7 days after that line was written, every reconnect ends in
final error sending batch, no retries left, dropping data: Loki returns 400,timestamp too old: 2026-11-09T06:26:34Z. All 126 drops in 30 hours are that one stream,{log_type="docker", service_name="sensor-zeek"}, and that one timestamp. loki_write_dropped_entries_total{reason="ingester_error"}stands at 1363 on fenrir. The audit of 2026-11-13 read 0.- Zeek's protocol logs (
job="zeek",loki.source.file) are not affected: 1.5M entries sent, and none dropped.
Why
stacks/observability/docker-socket-proxy/haproxy.cfg sets timeout client 10m and timeout server 10m in defaults. /containers/<id>/logs?follow=1 goes to dockerbackend, which inherits those timeouts. Only /events has its own backend with timeout server 0. A follow stream with nothing to send for 10 minutes is therefore idle, and HAProxy closes it. Alloy then reconnects with since set to the last saved position. Docker appears to treat since as inclusive, so it returns the last line again, and Alloy ships it again. This is inferred from the same 06:26:34 timestamp coming back on every reconnect; Docker's behaviour was not checked separately.
The 10-minute rhythm matches the timeout to within seconds. Busy containers write within any 10-minute window, so they never reach it.
Who is affected
Every host that runs docker.alloy through this proxy. That is every stack that mounts haproxy.cfg: observability (the monitoring host), lab (alexander), soc (odin), sensor (fenrir), analyst (garuda) and bloodhound (eden). oracle reads the socket directly (DOCKER_API unset), so it should be unaffected, though that is unverified.
On the estate, stack.rules.yaml's loki_write_dropped_entries_total rule (for: 1h) would fire once a quiet container's last line turns 7 days old. The lab's Prometheus has no such rule, so on the lab guests the drops are silent. That is how fenrir has been dropping since 11-16 with no alert.
Proposed fix
- Send
/containers/<id>/logsto a backend with no idle timeout, as/eventsalready has. That could be the existingdocker-eventsbackend, or a newdocker-logsbackend withtimeout server 0. The frontend also needstimeout clientlifted for those requests (http-request set-timeout client 0/set-timeout server 0, or a dedicated frontend path). Either way it stays inside theBEGIN homelabblock, with the reason stated. - Carry the dropped-entries rule into the lab's Prometheus, so that a lab guest losing log lines alerts, as an estate host's does.
- Verify on fenrir: after
make up STACK=sensor,could not transfer logsstops recurring forsensor-zeek, andloki_write_dropped_entries_totalstops rising. Check the same on one estate host.
Recreating the container clears today's instance on fenrir. It does not fix the cause.
Refs #836, the proxy's introduction to the agents.
Activity
docs(sensor): close fenrir's 2026-11-13 audit on the box
fix(socket-proxy): hold quiet log follows open past the idle timeouts (…
docs(sensor): close fenrir's 2026-11-13 audit on the box (#1561)
Gerrrt commentedon Nov 18, 2026
Verified on fenrir after #1560 (merged as a7270d9).
make up STACK=sensorran frommainat e980420 at 00:05 UTC on 2026-11-18. The running proxy has theset-timeout client 24dline and theuse_backend docker-eventsline for/logs. All three services are healthy.could not transfer logsin the hour before the deploy.sensor-zeek's follow ran idle past the old 10-minute timeout more than twice; its last stdout line is from 2026-11-17 22:33. The old proxy cut it every 10 minutes.loki_write_dropped_entries_totalseries on fenrir reads 0 (reset by the 2026-11-17 reboot, and still flat).missing timeouts for backend 'docker-events'. That comes from upstream's owntimeout server 0on that backend, which the original config already carried; it is not new behaviour.Not checked: the same on an estate host.
🤖 Closed by Claude Code