Repository navigation
fix(socket-proxy): hold quiet log follows open past the idle timeouts - #1560
Merged
Merged
Conversation
The socket proxy inherited upstream's ten-minute client and server idle
timeouts, so a quiet container's log follow was closed every ten minutes.
Alloy reconnected and re-sent the last line, and Loki rejected it once it
was seven days old. The fix lifts the client timeout and routes the
server side to the backend with no timeout, for /containers/{id}/logs
only. check_socket_proxy.sh proves it with shortened timeouts and a
control, and the lab gains the estate's LogEntriesDropped rule.
Refs #1552.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…follow-timeout # Conflicts: # docs/changelog.md
There was a problem hiding this comment.
🔵 Needs a closer look
The shared HAProxy change affects log collection across six stacks and deployed agents, but skipped local runtime checks leave CI results and planned fenrir canary validation requiring human review.
No open issues 🎉
What changed in this PR
Addresses quiet-container log replay in #1552 by extending socket-proxy log-follow lifetimes without widening allowed paths. Adds lab alerting for sustained log loss.
Changes:
- Sets a 24-day client timeout for container log requests and routes them through the backend with no server timeout.
- Adds an accelerated idle-timeout regression check with a control configuration, while preserving upstream drift checks.
- Adds the lab’s
LogEntriesDroppedalert, firing and restart-burst tests, and supporting documentation.
Docker-based verification and deployment confirmation remain pending.
| File | Description |
|---|---|
stacks/observability/docker-socket-proxy/haproxy.cfg |
Extends client and server idle limits for container log requests. |
stacks/lab/README.md |
Updates the rule count and describes log-loss coverage. |
stacks/lab/prometheus/tests/lab.test.yaml |
Tests sustained log-loss alerting and restart-burst suppression. |
stacks/lab/prometheus/rules/lab.rules.yaml |
Adds LogEntriesDropped with a one-hour pending period. |
scripts/check_socket_proxy.sh |
Adds idle-follow and control checks; updates drift reconstruction. |
docs/security.md |
Documents longer log follows and unchanged path restrictions. |
docs/changelog.md |
Records the timeout fix, alert addition, and pending deployment verification. |
Review effort: Balanced
This was referenced Nov 18, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
docker-socket-proxy now holds a
loki.source.dockerlog follow open past upstream's 10-minute idle timeouts, for/containers/{id}/logsonly, so Alloy stops re-sending a quiet container's last line every ten minutes. The lab's Prometheus gains the estate'sLogEntriesDroppedrule, so a lab guest dropping log lines now alerts.stacks/observability/docker-socket-proxy/haproxy.cfg:http-request set-timeout client 24don the/logspath, inside the existinghomelabblock before its allow rule. A secondhomelabblock at the end routes/logsto upstream'sdocker-eventsbackend (timeout server 0). The header's new "3." explains why.scripts/check_socket_proxy.sh: the drift check expects two blocks. A new idle section boots the pinned image on a copy of the config with the idle timeouts cut to 5 s. A follow on a quiet container must still be open at 20 s. A control copy without the two Alloy re-sends a quiet container's last log line every 10 minutes through the socket proxy #1552 lines must close the same follow within that window, after at least the timeout./eventsis followed too, and its lifetime is printed for the record.stacks/lab/prometheus/rules/lab.rules.yaml:LogEntriesDropped, with the estate's expression andfor: 1h. Tests: a firing case of fenrir's shape and a quiet restart burst. Counts are 22 → 23.docs/security.mdanddocs/changelog.md.Why
Refs #1552. The defaults'
timeout client 10m/timeout server 10mclosed an idle follow. Alloy reconnected from its saved position and shipped the last line again. Once that line was 7 days old, Loki rejected every copy: 1363 entries on fenrir, with no alert in the lab.Two HAProxy facts shaped the fix. Both come from the 3.4 manual;
haproxy -vin the pinned image reads 3.4.2.set-timeout"must be non-null", so0is not used.24dis just under HAProxy's 2^31 ms timer limit.set-timeout serveronly works in a section with backend capabilities, and the frontend has none. So the server side comes from routing todocker-events, whose only difference fromdockerbackendistimeout server 0.Refs #836.
Blast radius
Every Alloy behind this file: the six compose stacks and
deploy-agent.sh's agent proxies. If it's wrong, docker log collection stalls or keeps re-sending. No path is newly allowed: the allow rules are unchanged, and the drift check still proves upstream's template is unchanged under ours.secrets/*.sops.yamlVerification
Run on a Mac with no Docker daemon, so everything that boots an image skipped. That includes the new idle test, which only CI's hardened boot exercises.
make validatedid not pass locally. The failures are this host's toolchain, not the change: sub-scripts found no PyYAML,flockis missing, BSDstatlacks-c, andansible-lint's local runner fails. Every Docker check skipped.promtool check rules→23 rules found.promtool test rulespassed for both lab test files, and "every alert rule is selected by a promtool test" passed.check_docs.py(PyYAML in a venv) →docs OK — 164 Prometheus + 21 Loki rules, 8 dashboards, 156 panels, 14 assertions.lint.sh: yamllint passed. shellcheck and actionlint passed on local binaries, not the pinned ones. markdownlint, editorconfig-checker, packer and tofu skipped.The drift rebuild, run alone against upstream's v0.5.0
haproxy.cfgfrom GitHub: identical. The control derivation was checked by diff: it removes exactly theset-timeoutline and the second block.make validatepasses (CI)Deployed to the lab and confirmed working. After merge:
make up STACK=sensoron fenrir, then an hour with no recurringcould not transfer logsforsensor-zeekand a flatloki_write_dropped_entries_total. The issue stays open until that check passes.Docs updated (
docs/, service README, ordocs/roadmap.md)🤖 Generated with Claude Code