Ravindra BagaleCourses & study guides मराठी

Chapter 95: Logging with Loki, Elastic Stack and CloudWatch

DevOps

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.

Ingestion with Alloy — current collector choice
Ingestion with Alloy — current collector choice

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

  1. Treat older Promtail snippets as migration context, not a new-install recommendation.

  2. Read only an explicit synthetic file path in a lab.

  3. Persist collector positions intentionally and understand restart semantics.

  4. Do not start a collector or scrape real logs for this chapter.

Example 1: Read-only configuration study, not a running collector

  1. 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"
  }
}
  1. 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.
  1. Line by line: The source component has a unique classroom name. targets contains one absolute fake-lab file, not /var/log or a broad wildcard. app and env are stable labels. forward_to connects 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.

Did you understand? Let us try it once more.