Skip to content

feat(observability): split logs.alloy so the range host is metrics-only (#1651) - #1682

Merged
Gerrrt merged 3 commits into
mainfrom
gerrrt/metrics-only-agent
Nov 23, 2026
Merged

Gerrrt merged 3 commits into
mainfrom
gerrrt/metrics-only-agent

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 23, 2026

Copy link
Copy Markdown
Owner

What changed

The metrics-only agent config #1651/ADR-0126 need, so the range host gandalf ships metrics and no logs (its journal/auth logs can carry the attacker's segment).

  • config.alloy is split: the log pipeline — the journal/auth/var/syslog file sources, the level normaliser (log_processor), and loki.write — moves to a new logs.alloy. config.alloy keeps the metrics pipeline and prometheus.remote_write.
  • deploy-agent.sh --metrics-only: ships config.alloy without logs.alloy, refuses a docker host (its docker.alloy forwards to the log pipeline), and verifies metrics alone (no Loki check).
  • The five stacks that mount config.alloy individually (analyst, soc, lab, sensor, bloodhound) now mount logs.alloy beside it, so their logging is unchanged. The observability stack mounts the whole directory, so it picks logs.alloy up automatically.
  • build-the-playground.md §7 gives gandalf's deploy command (--metrics-only --runtime native). config.alloy's header, observability.md and architecture.md updated 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 --test on all four .alloy files — clean.
  • alloy validate stacks/observability/alloy/ (the full merged set, docker.alloy's cross-file references to log_processor/loki.write included) — valid.
  • alloy validate on config.alloy alone (exactly what a --metrics-only host 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.alloy instead of one file — behaviour-preserving (the log blocks are unchanged and still deployed everywhere except a --metrics-only host). Only gandalf, which isn't deployed yet, ends up metrics-only.

  • No change to network segmentation or firewall rules
  • No new port published to a VLAN that could not already reach the service
  • No credential added outside secrets/*.sops.yaml

Verification

  • make validate passes. Not run (no docker on this Mac). What ran:
    • alloy fmt --test (v1.22.0, the pinned version) on all four configs, and alloy validate on the directory and on the metrics-only config — all clean.
    • python3 scripts/check_docs.py: docs OK. check_compose_vars.py: OK.
    • markdownlint-cli2 0.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).
  • Deployed to the lab and confirmed working. No — the live deploy (the morpheus pass, running deploy-agent.sh --metrics-only on gandalf, converge) is the remaining Monitor gandalf now that it stays on #1651 step.
  • Docs updated

🤖 Generated with Claude Code

…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>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 19:10
@Gerrrt
Gerrrt enabled auto-merge (squash) November 23, 2026 19:11

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.

🟡 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

Comment thread docs/runbooks/build-the-playground.md Resolved
Gerrrt and others added 2 commits November 23, 2026 11:15
…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>
@Gerrrt
Gerrrt merged commit 90dc5e7 into main Nov 23, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/metrics-only-agent branch November 23, 2026 19:32
Gerrrt added a commit that referenced this pull request Nov 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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