Chapter 95: Logging with Loki, Elastic Stack and CloudWatch
95.7 Ingestion with Alloy — current collector choice
Story (fictional teaching scenario). At a fictional Thane firm, Maya and Ben from Melbourne open an old Promtail tutorial. They check current documentation instead of copying an obsolete deployment.
Why
An ingestion tutorial must not recommend a retired collector for a new installation.
What
- Grafana Alloy is a collector distribution that can process/forward telemetry, including logs through its Loki components.
- A component has a named role and input/output connections.
- A receiver is a component input destination.
- Official Promtail documentation says Promtail reached EOL on 2 March 2026: no future support/updates; migrate to Alloy or another supported client. The lambda-promtail client is explicitly excluded from that deprecation notice.
How
-
Treat older Promtail snippets as migration context, not a new-install recommendation.
-
Read only an explicit synthetic file path in a lab.
-
Persist collector positions intentionally and understand restart semantics.
-
Do not start a collector or scrape real logs for this chapter.
Example 1: Read-only configuration study, not a running collector
- Read the command or request.
loki.source.file "classroom" {
targets = [{__path__ = "/tmp/rb-logging-lab/synthetic.jsonl", app = "bakery", env = "lab"}]
forward_to = [loki.write.classroom.receiver]
}
loki.write "classroom" {
endpoint {
url = "http://127.0.0.1:13100/loki/api/v1/push"
}
}
- Read the result.
Output (illustrative; NOT executed against Loki, Elastic or CloudWatch)
If a compatible disposable local setup existed, complete newline-terminated events would be forwarded. Nothing is started here.
- Line by line: The source component has a unique classroom name.
targetscontains one absolute fake-lab file, not /var/log or a broad wildcard.appandenvare stable labels.forward_toconnects the source to a receiver. The write component names a loopback-only example endpoint. Positions/state configuration and a real Loki server are not provided or tested; this is an illustrative wiring example.
Ravindra Bagale's Tip
An old working example may no longer be a supported starting point.
जुनं चालणारं example आज supported starting point असेलच असं नाही.
पुराना चलता example आज supported शुरुआत हो, जरूरी नहीं.
Did you understand? Let us try it once more.