Cette page est affichée en anglais. Une traduction française est en cours.
SkillsApr 10, 2026·3 min de lecture

Grafana Loki — Prometheus-Inspired Log Aggregation System

Loki is a horizontally scalable, multi-tenant log aggregation system by Grafana Labs. Unlike other log systems, Loki indexes metadata about logs, not log content itself.

Prêt pour agents

Installation avec revue préalable

Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.

Needs Confirmation · 64/100Policy : confirmer
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Community
Point d'entrée
step-1.md
Commande avec revue préalable
npx -y tokrepo@latest install 92fa7c1f-352f-11f1-9bc6-00163e2b0d79 --target codex

Dry-run d'abord, confirmez les écritures, puis lancez cette commande.

TL;DR
Loki indexes log metadata instead of full text, making it far cheaper than traditional log systems like ELK.
§01

What it is

Grafana Loki is a horizontally scalable, multi-tenant log aggregation system inspired by Prometheus. Built by Grafana Labs, Loki takes a distinct approach to log management: it indexes only labels (metadata) rather than the full text of every log line. This makes storage and indexing dramatically cheaper than systems like Elasticsearch that index all content.

Loki targets DevOps and SRE teams already using Prometheus and Grafana for metrics who want a unified observability stack. It integrates natively with Grafana dashboards and uses a query language called LogQL that mirrors PromQL syntax.

§02

How it saves time or tokens

By indexing only labels, Loki reduces storage costs to a fraction of what Elasticsearch or Splunk requires. Promtail, the log collector agent, automatically attaches Kubernetes labels to log streams, eliminating manual log parsing configuration. LogQL lets you filter, aggregate, and create alerts from logs using the same patterns you already know from PromQL.

§03

How to use

  1. Run Loki as a Docker container: docker run -d --name loki -p 3100:3100 grafana/loki:latest.
  2. Deploy Promtail as a log collector that ships log streams to Loki from your application servers or Kubernetes nodes.
  3. Add Loki as a data source in Grafana at http://localhost:3100 and query logs using LogQL.
§04

Example

# Docker Compose for Loki + Promtail
version: '3'
services:
  loki:
    image: grafana/loki:latest
    ports:
      - '3100:3100'
  promtail:
    image: grafana/promtail:latest
    volumes:
      - /var/log:/var/log:ro
      - ./promtail-config.yml:/etc/promtail/config.yml

LogQL query examples:

{job="nginx"} |= "error"
{namespace="production"} | json | status >= 500
rate({job="api"}[5m])
§05

Related on TokRepo

§06

Common pitfalls

  • Loki does not index log content, so full-text search across large time ranges is slower than Elasticsearch; use label filters to narrow the scope first.
  • High-cardinality labels (like user IDs or request IDs) cause performance degradation; keep label sets small and consistent.
  • Promtail requires explicit configuration for non-Kubernetes log sources; file paths and parsing rules must be defined manually.

Questions fréquentes

How does Loki compare to the ELK stack?+

Loki indexes only metadata labels while Elasticsearch indexes full log text. This makes Loki cheaper to run and simpler to operate, but full-text search is slower. Loki is best when you have structured labels and use Grafana for visualization.

What is LogQL?+

LogQL is Loki's query language, modeled after PromQL. It supports label matchers, line filters, parsing pipelines, and aggregation functions. If you know PromQL, LogQL syntax will feel familiar.

Can Loki handle production-scale log volumes?+

Yes. Loki scales horizontally by separating read and write paths. Each component (ingester, querier, compactor) can be scaled independently. Many organizations run Loki with terabytes of daily log ingestion.

Does Loki support alerting?+

Yes. Loki includes a ruler component that evaluates LogQL alerting rules and sends notifications through Alertmanager, the same tool used for Prometheus alerts.

What log collectors work with Loki?+

Promtail is the primary collector, but Loki also accepts logs from Fluentd, Fluent Bit, Vector, and any client that speaks the Loki HTTP push API.

Sources citées (3)

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires