Skip to main content
We built the sorting center. Now we need the couriers. Picture a courier stationed at each building. Their whole job is to pick up the mail as it arrives and deliver it to the sorting center repeatedly, without anyone having to ask each time.
A slide titled "Now we need couriers" showing three building icons with courier avatars and mail icons on the left, and a large illustrated "sorting center" building on the right.
Your machines need the same thing. Loki is running, but it will remain empty until something sends logs to it. On each host, your applications write log files; you need an agent to watch those files and forward every new line to Loki as it appears. That role is fulfilled by Grafana Alloy. Alloy is a lightweight, host-level agent you install on every machine — like a courier at each building — which ships logs to Loki on your behalf. If you’ve used Promtail in older guides, note that Promtail has been deprecated; Grafana now recommends Alloy as the supported successor.
A simple architecture diagram titled "Meet Grafana Alloy" showing logs (app.log, syslog) on "your server" collected by an Alloy agent and sent along a line to a Loki inbox on the right. The image also notes Promtail as retired and Alloy as the replacement.
We will use Alloy for the rest of this lesson. How Alloy works (high level)
  • Alloy’s configuration is built from small, focused components. You connect these components into a pipeline so that the output of one is the input of the next.
  • Typical pipeline stages:
    • File discovery — find the log files to read (for example, everything under /var/log).
    • File tailing — follow files and emit each new line as it is written.
    • Batching and shipping — group entries and forward them to your Loki server endpoint.
Think of it as a conveyor belt: discovery feeds tailing, tailing feeds batching, and batching pushes into Loki. Table — Alloy pipeline components (overview)
Promtail — which you may see in older guides — is deprecated. Use Alloy as the supported replacement for tailing and shipping logs to Loki. For official docs and migration guidance, see the Grafana Alloy and Loki documentation.
Simple, conceptual example configuration The exact syntax of Alloy configuration depends on the agent version and installer you use. The snippet below is a simplified conceptual example to illustrate the pipeline idea:
Next steps
  • Install Alloy on each host you want to collect logs from.
  • Configure discovery patterns to include your application and system logs.
  • Point Alloy at your Loki instance (use the Loki push endpoint).
  • Test by generating log lines and verifying they appear in Loki / Grafana.
Links and references This establishes the courier pattern: lightweight agents on each host continuously collect and forward logs into the sorting center (Loki), so you can search, visualize, and alert on your logs centrally.

Watch Video