Skip to main content

Set Up Loki

Loki is the second piece. It stores the log lines that Alloy sends.

Table of Contents


Why​

Loki is the "nurse's notes" in The Grafana Stack. Metrics tell you that something changed. Logs tell you what the app said at that moment.

Loki needs no config file here. The defaults are enough for a lab.


How: start Loki​

Use the same terminal as Set Up Prometheus, so NET is still set.

docker run -d --name loki --network "$NET" -p 3100:3100 grafana/loki:3.7.8

How: check it​

curl -s localhost:3100/ready

Expected, after about 15 seconds:

ready

Right after the start it can say this instead. Wait and run the command again.

Ingester not ready: waiting for 15s after being ready

Tips​

  • Loki does not index the full text of each line. It indexes only the labels, such as service. So you always pick the label first ({service="api"}), then search inside the lines.
  • Like Prometheus, Loki has no volume here. docker rm erases the logs.
  • Nothing is in Loki yet. Logs arrive once Alloy starts on the next page.
  • If NET is empty after a new terminal, run the lookup from page 05 again.

Next: Set Up Alloy.