Skip to content

fix(sensor): measure the memory bounds; zeek's halves to 2048m - #1575

Merged
Gerrrt merged 1 commit into
mainfrom
fix/sensor-memory-bounds
Nov 19, 2026
Merged

Gerrrt merged 1 commit into
mainfrom
fix/sensor-memory-bounds

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What changed

  • stacks/sensor/compose.yaml: zeek's mem_limit/memswap_limit go from 4096m to 2048m. The comments on zeek and alloy now record measurements instead of "a bound, not a measurement".
  • docs/changelog.md: a 2026-11-18 entry with the numbers and what is still open from fenrir's audit.

Why

The audit of 2026-11-13 (next step 4) asked for the sensor stack's bounds to be re-derived, as the compose comments had said since October. The lab's Prometheus keeps only the root cgroup for fenrir, so:

  • Alloy: process_resident_memory_bytes{job="fenrir-alloy"} over the 12 days of history peaked at 297 MiB, median 286. 1024m is the estate's ~3.5x (Set memory limits on the six services to bound the blast radius of a leak #114), so it stays.
  • Zeek: read on the box. VmHWM was 286 MiB (103 MiB anonymous) over the 25 h since the 2026-11-17 reboot; the cgroup's memory.peak was 352 MiB, page cache included. Earlier days are hidden in the guest's whole-host RSS, which workstation tooling held near 1 GiB (spikes to 1.4 GiB) until the cleanup at about 23:00 UTC 2026-11-17; since then it has peaked at 396 MiB. 2048m is about 7x, not 3.5x: a day is thin, it held no attack exercise, Zeek's state grows with connections, and an OOM-kill only restarts it with nothing alerting. The comment says to tighten it once a fortnight that includes an exercise has been read.

Blast radius

The sensor stack on fenrir only, and only once make up STACK=sensor runs there; the change recreates sensor-zeek, so capture stops for a few seconds. 2048m is 7x the measured peak, so no OOM is expected. The guest's 8 GiB in build-the-sensor-guest.md is still described as a bound to re-derive, which stays true; this PR does not touch it.

Verification

  • The measurements above: queries against the lab's Prometheus on alexander, and /proc/<pid>/status and the cgroups' memory.peak on fenrir (read-only, no sudo).
  • Locally: the compose file parses, with zeek 2048m, alloy 1024m and the proxy 64m. check_docs.py and the close-keyword check pass. lint.sh passes yamllint, shellcheck, ruff and actionlint (local binaries); it skips markdownlint-cli2, zizmor, packer, tofu and editorconfig-checker, which need a docker daemon the Mac lacks, and ansible-lint fails on the Mac's runner, which is environmental: no Ansible changes here. CI runs them all, including the stack boots.
  • After merge: make up STACK=sensor on fenrir, then docker inspect -f '{{.HostConfig.Memory}}' sensor-zeek reads 2147483648 and the container is healthy.

🤖 Generated with Claude Code

Alloy's 1024m is confirmed by 12 days of its own RSS (peak 297 MiB).
Zeek's 286 MiB peak comes from only 25 h on the box, with no attack
exercise in it, so its limit drops to about 7x that rather than the
estate's 3.5x, and the comment says when to tighten it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 23:59
@Gerrrt
Gerrrt enabled auto-merge (squash) November 18, 2026 23:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The sensor memory-limit adjustment has no active review issues.

No open issues 🎉

What changed in this PR

This PR uses measured memory usage to revise the sensor stack’s limits on fenrir, reducing Zeek’s allocation while retaining headroom for attack exercises.

Changes:

  • Reduce Zeek’s memory and memory-plus-swap limits from 4096m to 2048m.
  • Update Zeek and Alloy comments with measurements and sizing rationale; Alloy remains at 1024m.
  • Add a changelog entry recording the measurements and remaining audit work.
File Description
stacks/​sensor/​compose.yaml Halves Zeek’s limits and documents measured usage for Zeek and Alloy.
docs/​changelog.md Records the limit adjustment, supporting measurements, and audit follow-ups.

Review effort: Balanced

@Gerrrt
Gerrrt merged commit 54ff0d7 into main Nov 19, 2026
10 checks passed
@Gerrrt
Gerrrt deleted the fix/sensor-memory-bounds branch November 19, 2026 00:07
@Gerrrt Gerrrt mentioned this pull request Nov 19, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants