How openshift/loki works
Loki is a horizontally scalable, multi-tenant log aggregation system: agents push labeled log streams to Loki, which stores them and serves LogQL queries to users such as Grafana and LogCLI. The repository also includes query execution, retention/deletion, rule storage, operational tooling, and collection integrations. Internal edges are limited to relationships named by the source index or README; unsampled subsystem wiring is not inferred.
Main entry points: main.go Loki service · query.go CLI queries · engine_router.go Query router · engine_query.go Query workflow
Components 20
Collection and ingestion
- Log agents
- Client integrations
clients/cmd - Loki service
cmd/loki/main.go - Ingestion policies
pkg/validation/ingestion_policies.go
Query and access
- Grafana
- LogCLI
cmd/logcli/main.go - CLI queries
pkg/logcli/query/query.go - LogQL engine
pkg/logql/engine.go - Query router
pkg/querier/queryrange/engine_router.go - Query engine
pkg/engine/engine.go - Query workflow
pkg/engine/engine_query.go - Query executor
pkg/engine/internal/executor/pipeline.go
Storage and lifecycle
- Object storage
pkg/storage/chunk/client/aws/s3_storage_client.go - Azure storage
pkg/storage/chunk/client/azure/blob_storage_client.go - Compactor
pkg/compactor/tables_manager.go - Deletion manager
pkg/compactor/deletion/delete_requests_manager.go - Migration tool
cmd/migrate/main.go
Operations and rules
- Loki Canary
cmd/loki-canary/main.go - Rule storage
pkg/ruler/base/storage.go - Rule instances
pkg/ruler/storage/instance/manager.go
Connections 13
- Log agents → Loki service: push logs
README.md - Client integrations → Loki service: send logs
- Grafana → Loki service: query logs
README.md - LogCLI → CLI queries: runs queries
cmd/logcli/main.go - CLI queries → Query router: requests data
- Query router → LogQL engine: routes queries
pkg/querier/queryrange/engine_router.go - Query engine → Query workflow: prepares workflow
pkg/engine/engine.go - Query workflow → Query executor: executes plan
pkg/engine/engine_query.go - Loki service → Ingestion policies: validates ingestion
- Compactor → Deletion manager: manages deletion
pkg/compactor/tables_manager.go - Migration tool → Object storage: migrates storage
- Loki Canary → Loki service: checks delivery
- Rule instances → Rule storage: stores rules