MCPcopy
hub / github.com/grafana/loki

github.com/grafana/loki @v3.7.3 sqlite

repository ↗ · DeepWiki ↗ · release v3.7.3 ↗
34,396 symbols 143,516 edges 2,636 files 9,187 documented · 27%
README

Loki Logo

Check Go Report Card Slack Fuzzing Status

Loki: like Prometheus, but for logs.

Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus. It is designed to be very cost effective and easy to operate. It does not index the contents of the logs, but rather a set of labels for each log stream.

Compared to other log aggregation systems, Loki:

  • does not do full text indexing on logs. By storing compressed, unstructured logs and only indexing metadata, Loki is simpler to operate and cheaper to run.
  • indexes and groups log streams using the same labels you’re already using with Prometheus, enabling you to seamlessly switch between metrics and logs using the same labels that you’re already using with Prometheus.
  • is an especially good fit for storing Kubernetes Pod logs. Metadata such as Pod labels is automatically scraped and indexed.
  • has native support in Grafana (needs Grafana v6.0).

A Loki-based logging stack consists of 3 components:

  • Alloy is agent, responsible for gathering logs and sending them to Loki.
  • Loki is the main service, responsible for storing logs and processing queries.
  • Grafana for querying and displaying the logs.

Note that Alloy replaced Promtail in the stack, because Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy.

Loki is like Prometheus, but for logs: we prefer a multidimensional label-based approach to indexing, and want a single-binary, easy to operate system with no dependencies. Loki differs from Prometheus by focusing on logs instead of metrics, and delivering logs via push, instead of pull.

Getting started

⚠️ Helm Chart Migration

Effective March 16, 2026, the Grafana Loki Helm chart will be forked to a new repository grafana-community/helm-charts. The chart in the Loki repository will continue to be maintained for GEL users only. See #20705 for details.

Upgrading

Documentation

Commonly used sections:

Getting Help

If you have any questions or feedback regarding Loki:

Your feedback is always welcome.

Further Reading

Contributing

Refer to CONTRIBUTING.md

Building from source

Loki can be run in a single host, no-dependencies mode using the following commands.

You need an up-to-date version of Go, we recommend using the version found in our Makefile

# Checkout source code
$ git clone https://github.com/grafana/loki
$ cd loki

# Build binary
$ go build ./cmd/loki

# Run executable
$ ./loki -config.file=./cmd/loki/loki-local-config.yaml

Alternatively, on Unix systems you can use make to build the binary, which adds additional arguments to the go build command.

# Build binary
$ make loki

# Run executable
$ ./cmd/loki/loki -config.file=./cmd/loki/loki-local-config.yaml

To run multiple Loki tenants locally, ensure that auth_enabled is set to true and provide a runtime config with any tenant specific overrides.

# Build binary
$ make loki

# Run executable
./loki -config.file=./cmd/loki/loki-local-multi-tenant-config.yaml -runtime-config.file=./cmd/loki/loki-overrides.yaml

Adopters

Please see ADOPTERS.md for some of the organizations using Loki today. If you would like to add your organization to the list, please open a PR to add it to the list.

License

Grafana Loki is distributed under AGPL-3.0-only. For Apache-2.0 exceptions, see LICENSING.md.

Extension points exported contracts — how you extend this code

SectionBuilder (Interface)
A SectionBuilder accumulates data for a single in-progress section. Each section package provides an implementation of [6 …
pkg/dataobj/section.go
RangeStreamingAgg (Interface)
RangeStreamingAgg streaming aggregates sample for each sample [14 implementers]
pkg/logql/range_vector.go
ReadLifecycler (Interface)
ReadLifecycler represents the read interface to the lifecycler. [6 implementers]
pkg/distributor/ingestion_rate_strategy.go
ReadClient (Interface)
Client for the read path. [15 implementers]
pkg/storage/stores/series/index/index.go
Instruction (Interface)
An Instruction is an SSA instruction that computes a new [Value] or has some effect. Instructions that define a value ( [13 …
pkg/engine/internal/planner/logical/logical.go
ASTMapper (Interface)
ASTMapper is the exported interface for mapping between multiple AST representations [6 implementers]
pkg/querier/astmapper/astmapper.go
Datum (Interface)
A Datum is a piece of data which either represents an [Array] or a [Scalar]. [6 implementers]
pkg/columnar/columnar.go
WriterPool (Interface)
WriterPool is a pool of io.Writer This is used by every chunk to avoid unnecessary allocations. [6 implementers]
pkg/compression/pool.go

Core symbols most depended-on inside this repo

Add
called by 3020
pkg/storage/chunk/interface.go
Run
called by 2499
pkg/ruler/base/compat.go
Log
called by 1721
pkg/ingester/checkpoint.go
String
called by 1653
pkg/util/flagext/csv.go
Join
called by 1630
pkg/pattern/drain/line_tokenizer.go
New
called by 1393
pkg/bloomgateway/client_pool.go
Len
called by 975
pkg/columnar/columnar.go
Time
called by 722
cmd/chunks-inspect/time.go

Shape

Method 19,938
Function 9,448
Struct 3,848
Interface 631
TypeAlias 378
FuncType 153

Languages

Go100%
TypeScript1%
Python1%

Modules by API surface

pkg/logproto/logproto.pb.go1,175 symbols
pkg/querier/queryrange/queryrange.pb.go621 symbols
pkg/engine/internal/proto/physicalpb/physicalpb.pb.go579 symbols
pkg/engine/internal/proto/wirepb/wirepb.pb.go557 symbols
pkg/storage/chunk/client/grpc/grpc.pb.go463 symbols
pkg/engine/internal/proto/expressionpb/expressionpb.pb.go431 symbols
pkg/logql/syntax/ast.go304 symbols
pkg/logproto/sketch.pb.go280 symbols
pkg/xcap/internal/proto/xcap.pb.go267 symbols
pkg/dataobj/compaction/proto/compaction.pb.go259 symbols
pkg/logqlmodel/stats/stats.pb.go257 symbols
pkg/limits/proto/limits.pb.go231 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

cel.dev/exprv0.25.1 · 1×
charm.land/bubbles/v2v2.0.0 · 1×
charm.land/bubbletea/v2v2.0.2 · 1×
charm.land/lipgloss/v2v2.0.2 · 1×
cloud.google.com/gov0.123.0 · 1×
cloud.google.com/go/auth/oauth2adaptv0.2.8 · 1×
cloud.google.com/go/bigtablev1.43.0 · 1×
cloud.google.com/go/compute/metadatav0.9.0 · 1×
cloud.google.com/go/longrunningv0.8.0 · 1×
cloud.google.com/go/monitoringv1.24.3 · 1×

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add loki \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact