Centralized logging for a home lab: Loki and Alloy, not Promtail
When a service died last night, where do you look? If the honest answer is "SSH into whichever machine it probably ran on and start guessing," the lab has outgrown per-machine logs. The default strategy fails after the fact by design: by the time you log in to look, a recreated container's logs went with the old container, and the journal on a small root disk may already have rotated past the moment that mattered. Centralized logging fixes the sequence, the logs leave each machine as they are written, and the question gets asked later, in one place, across every host at once.
First, the trap: Promtail is end of life
Search for a home-lab logging guide today and most of what ranks still builds the stack on Promtail, Grafana's original log collector, complete with scrape configs to copy. Check that claim against the vendor before copying anything: Grafana's own documentation states that Promtail reached end of life on March 2, 2026 and is no longer maintained, and that anyone using it must migrate to Grafana Alloy. The timeline was published well ahead. Promtail entered long-term support on February 13, 2025, with the March 2, 2026 end of life as the final step, and Grafana merged Promtail's capabilities into Alloy, its open-source distribution of the OpenTelemetry Collector. A new stack built on Promtail in late 2026 is unmaintained software installed on purpose, with a migration already owed. Start on Alloy and skip that debt entirely.
The three pieces and what each one does
| Piece | Job | Why this one |
|---|---|---|
| Loki | The central store and query engine | Indexes only a small set of labels and stores the log lines compressed in chunks, light enough for a home lab, unlike a full-text search index |
| Alloy | The agent on each host: reads the journal and container logs, attaches labels, ships the lines | The maintained successor Grafana directs new setups to; it also converts existing Promtail configs with a built-in command |
| Grafana | The window: queries Loki with LogQL | Puts the answers one Explore query away instead of one SSH session per host |
Already running Promtail somewhere? The migration is a conversion, not a
rewrite: alloy convert --source-format=promtail turns a Promtail
configuration file into an Alloy configuration. New builds skip straight to
the native form below.
Set it up: the store first, then an agent per host
- Run Loki on one always-on host, the same class of machine that hosts the lab's other infrastructure services. Give it disk you can afford to grow slowly; the label-indexed, compressed-chunk design is what keeps that growth slow.
- Install Alloy on every host whose logs matter, the hypervisor, each Docker host, the NAS if it runs services. Alloy is a native service on the host, which is what makes reading the systemd journal straightforward.
- Add the alloy user to the right groups. Grafana's docs
are explicit: the
alloyuser must be a member of theadmandsystemd-journalgroups to read the journal. Skip this and the journal source can start cleanly while collecting nothing. On Docker hosts, the alloy user also joins thedockergroup to read container logs through the socket, with the standing caveat that Docker socket access means full control of the host, which is a reason to keep the agent's host list deliberate. - Wire the journal source. In Alloy's component model,
loki.source.journalreads the journal andloki.relabelmaps the journal's unit field (__journal__systemd_unit) onto aunitlabel;loki.writeforwards everything to Loki's push endpoint,/loki/api/v1/push. The Docker source follows the same shape, with container names as labels instead of units. - Restart and prove it. Restart Alloy, then run the first starter query below for the host you just configured.
What success looks like: within a minute of the restart, a query for that host in Grafana returns its live journal lines, including lines written after Alloy started. An empty result with a healthy-looking service almost always means the group-membership step was skipped.
Labels: few and boring, on purpose
Loki is fast because its index is small, and the index is small only if
the labels are. Every distinct combination of label values creates a new
stream, so labels are for the handful of things worth filtering by:
host, job, unit,
container, level. Five, roughly, and no more.
Never turn request IDs, user names, IP addresses, or full file paths into
labels, that way lies stream explosion and a store that gets slower the
more it knows. Those details belong in the log line itself, where a line
filter can still find them at query time. Boring labels are not a
limitation of the design; they are the design.
Cap the local copies too
Central shipping does not retire the local logs, and the local defaults
are a disk incident on a timer. Docker's own documentation for the default
json-file driver lists max-size defaulting to
-1, unlimited, and max-file (default 1) only
takes effect when max-size is also set. A chatty container on
an uncapped host fills the disk in the background while its logs stream
happily to Loki. The fix is one block in /etc/docker/daemon.json
on each Docker host, max-size: "10m" and
max-file: "3" is a sane starting point, after which existing
containers pick the limits up when they are next recreated. Do the same for
the journal itself with a SystemMaxUse cap (500M is a workable
home-lab figure) in journald.conf. Loki is now the long memory;
the local copies only need to cover the last few days.
Three queries that pay for the stack
A log store nobody queries is just a second backup of text. These three LogQL patterns cover most 2 a.m. questions:
- One daemon, one host:
{host="pve1", unit="pvedaemon.service"}, what the Proxmox API daemon on the main host has been saying. - One container's errors:
{job="docker", container="immich_server"} |= "error", the label selector picks the stream, the line filter keeps only the lines containing "error." - Everything loud, everywhere:
{job="journal", level=~"err|crit|alert|emerg"}, every high-priority journal line across the lab, the query to run first when "something is wrong" and nobody knows which host it lives on.
That third query is the one per-machine logging can never answer. It is also the honest test of whether the stack was worth building: the first time it names the failing service before anyone has opened an SSH session, the setup has paid for itself.
Who should skip this
One host, two services, nothing the household depends on: read the logs where they live and spend the evening on something else. Centralized logging earns its keep when the lab has several hosts, containers that get recreated, or a service whose failure at night becomes a household problem by morning. Below that line it is ceremony. Above it, it is the difference between investigating a failure and archaeology.
, Dex Carter, Tech Writer