Repository navigation
feat(observability): split logs.alloy so the range host is metrics-only (#1651) - #1682
Merged
Merged
Conversation
…s-only (#1651) config.alloy mixed the metrics and log pipelines; gandalf's journal and auth logs can carry the attacker's segment. The log sources, the level normaliser and loki.write move to a new logs.alloy, deployed with config.alloy everywhere but a metrics-only host. deploy-agent.sh gains --metrics-only (omits logs.alloy, refuses a docker host, verifies metrics alone). The five stacks that mount config.alloy individually now mount logs.alloy too; observability mounts the whole directory. Verified with alloy v1.22.0 fmt and validate on the directory and on config.alloy alone. §7 gives gandalf's deploy command. Refs #1651. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The runbook omits prerequisite ingest-token registration and ingest-proxy redeployment steps, which can cause deployment to fail or metric pushes to receive 401 responses.
1 open issue
What changed in this PR
Separates Alloy’s log pipeline from metrics collection so gandalf can be monitored without forwarding range-host logs, supporting #1651 and ADR-0126.
Changes:
- Moves log sources, processing, and the Loki writer into
logs.alloy. - Adds metrics-only deployment and verification while preserving logging mounts in five existing stacks.
- Updates architecture, deployment instructions, and the changelog.
| File | Description |
|---|---|
stacks/soc/compose.yaml |
Mounts the separate log pipeline. |
stacks/sensor/compose.yaml |
Mounts the separate log pipeline. |
stacks/observability/alloy/logs.alloy |
Contains the extracted log sources, processor, and writer. |
stacks/observability/alloy/config.alloy |
Retains metrics collection and remote writing. |
stacks/lab/compose.yaml |
Mounts the separate log pipeline. |
stacks/bloodhound/compose.yaml |
Mounts the separate log pipeline. |
stacks/analyst/compose.yaml |
Mounts the separate log pipeline. |
scripts/deploy-agent.sh |
Adds --metrics-only and skips log verification in that mode. |
docs/runbooks/build-the-playground.md |
Documents metrics-only deployment for gandalf. |
docs/observability.md |
Updates the log-normalisation file reference. |
docs/changelog.md |
Records the split and deployment option. |
docs/architecture.md |
Describes the revised agent configuration layout. |
Review effort: Balanced
…deploy Review on #1682: deploy-agent needs gandalf's token registered in the ingest proxy first, or pushes get 401. §7 now links add-monitored-device.md's token step and requires recreating the proxy (make up) before the deploy command. Refs #1651. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…gent # Conflicts: # docs/changelog.md
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
The metrics-only agent config #1651/ADR-0126 need, so the range host
gandalfships metrics and no logs (its journal/auth logs can carry the attacker's segment).config.alloyis split: the log pipeline — the journal/auth/var/syslog file sources, the level normaliser (log_processor), andloki.write— moves to a newlogs.alloy.config.alloykeeps the metrics pipeline andprometheus.remote_write.deploy-agent.sh --metrics-only: shipsconfig.alloywithoutlogs.alloy, refuses a docker host (itsdocker.alloyforwards to the log pipeline), and verifies metrics alone (no Loki check).config.alloyindividually (analyst,soc,lab,sensor,bloodhound) now mountlogs.alloybeside it, so their logging is unchanged. The observability stack mounts the whole directory, so it pickslogs.alloyup automatically.build-the-playground.md§7 gives gandalf's deploy command (--metrics-only --runtime native).config.alloy's header,observability.mdandarchitecture.mdupdated for the fourth file; changelog added.This replaces the "metrics-only config — still to build" flag the #1651 build PR left.
Refs #1651.
How it was verified
I downloaded the pinned Alloy (
grafana/alloy:v1.22.0) and ran, locally:alloy fmt --teston all four.alloyfiles — clean.alloy validate stacks/observability/alloy/(the full merged set, docker.alloy's cross-file references tolog_processor/loki.writeincluded) — valid.alloy validateonconfig.alloyalone (exactly what a--metrics-onlyhost gets) — valid, so the metrics-only config has no dangling reference.The log blocks moved verbatim, so nothing in the log pipeline changed for the hosts that keep it.
Blast radius
The split touches the shared agent config, so every agent host now loads
config.alloy+logs.alloyinstead of one file — behaviour-preserving (the log blocks are unchanged and still deployed everywhere except a--metrics-onlyhost). Onlygandalf, which isn't deployed yet, ends up metrics-only.secrets/*.sops.yamlVerification
make validatepasses. Not run (no docker on this Mac). What ran:alloy fmt --test(v1.22.0, the pinned version) on all four configs, andalloy validateon the directory and on the metrics-only config — all clean.python3 scripts/check_docs.py:docs OK.check_compose_vars.py: OK.markdownlint-cli20.24.1:0 issues.shellcheck: clean../scripts/lint.sh: yamllint, ruff, shellcheck, actionlint pass; ansible-lint fails on the same local runner error as before (no Ansible here); markdownlint/zizmor/packer/tofu skipped (docker).morpheuspass, runningdeploy-agent.sh --metrics-onlyon gandalf, converge) is the remaining Monitor gandalf now that it stays on #1651 step.🤖 Generated with Claude Code