explaingit

grafana/loki

📈 Trending28,144GoAudience · ops devopsComplexity · 4/5ActiveLicenseSetup · hard

TLDR

A cost-effective log aggregation system that collects logs from many sources, indexes only labels (not full text), and lets you search through them, like Prometheus but for logs.

Mindmap

mindmap
  root((Loki))
    What it does
      Collects logs
      Stores compressed
      Searches by labels
    Architecture
      Alloy agent
      Loki engine
      Grafana dashboard
    Use cases
      Debug outages
      Trace errors
      Monitor services
    Tech stack
      Go language
      Cloud-native
      Self-hostable
    Key benefit
      Low cost
      Minimal indexing

Things people build with this

USE CASE 1

Debug production outages by searching logs across all your services in one place.

USE CASE 2

Trace errors and requests as they flow through multiple systems to find where things broke.

USE CASE 3

Monitor application behavior and performance by analyzing log patterns over time.

USE CASE 4

Self-host a centralized logging system without the high storage and indexing costs of traditional solutions.

Tech stack

GoPrometheusGrafanaAlloy

Getting it running

Difficulty · hard Time to first run · 1h+

Requires running multiple services (log collector, indexer, query API) and integrating with Prometheus/Grafana stack.

Open source under the Elastic License and Server Side Public License (SSPL); free to use and modify for most purposes, with restrictions on offering it as a managed service.

In plain English

Loki is a system for collecting, storing, and searching logs from software running across many machines. The pitch in the description is "like Prometheus, but for logs": Prometheus is a popular tool for tracking numerical metrics over time, and Loki applies the same style of thinking to log lines instead. It is built to be horizontally scalable, highly available, and multi-tenant, meaning many teams or projects can share one installation. The key idea that makes Loki different from other log tools is that it does not perform full text indexing on the contents of the logs. Instead, it stores the logs in a compressed form and only indexes a small set of labels for each log stream. That keeps it simpler to operate and cheaper to run, because building and storing a full text index is one of the most expensive parts of a typical log system. The labels Loki uses are the same kind of labels you already use with Prometheus, so you can move back and forth between metrics and logs using a shared vocabulary. It is described as a particularly good fit for Kubernetes pod logs, where labels are picked up automatically. A Loki-based stack has three pieces: an agent called Alloy that gathers logs and ships them in, Loki itself which stores the logs and answers queries, and Grafana as the front end you use to query and view the results. You would reach for it when you are running production services and want a logging backend that integrates naturally with a Prometheus-and-Grafana setup without the cost of a full-text log search engine. It is written in Go.

Copy-paste prompts

Prompt 1
How do I set up Loki with Alloy to start collecting logs from my servers?
Prompt 2
Show me how to query logs in Loki using labels like app=payments and environment=production.
Prompt 3
What's the difference between Loki and Elasticsearch for log storage, and when should I use each?
Prompt 4
How do I integrate Loki with Grafana to build dashboards that show logs and metrics together?
Prompt 5
What are best practices for labeling logs in Loki to keep queries fast and costs low?
Open on GitHub → Explain another repo

Generated 2026-05-21 · Model: sonnet-4-6 · Verify against the repo before relying on details.