Loki · Grafana Alloy
Loki · Grafana Alloy: a first setup, important settings, verification, and recovery considerations.
Working directory: ~/homelab/ops/logging. Follow the common setup workflow first. This is a setup note based on the linked documentation, not a copy of my live configuration or a runtime verification of this full stack.
Start here
Loki stores searchable logs; Alloy collects and sends them. Follow Grafana's local tutorial with a synthetic log file before collecting real container output. Add a Grafana view only after you can trace one line from source to storage. Metrics and logs answer different questions.
Settings and data
Persist Loki data and Alloy's collection state according to the chosen setup. Set finite retention and a disk-space budget. Use a small set of labels such as application and environment; per-request IDs are poor high-cardinality labels. Keep ingestion and query endpoints private.
Check it
Append a unique harmless test message, search for it, and compare its timestamp with the source. Restart the collector and check that collection resumes. Verify permissions prevent an unrelated user from querying the logs.
When something fails
Missing lines need source path, permissions, collector errors, network, and time range checked in that order. Do not grant broad Docker socket access just to avoid learning collection options. Logs may contain tokens, email addresses, or query strings. Filter sensitive fields before storage, and share only sanitized excerpts.