How does Grafana Loki store and find logs?
Grafana Loki indexes only the label set of each log stream and keeps the log lines as compressed chunks in object storage such as S3 or GCS. Queries written in LogQL select streams by label, then filter and parse the matching lines. LogQL is similar to PromQL and can also generate metrics from logs. The Loki GitHub README describes the project as a multi-tenant log aggregation system that scales horizontally and is designed for high availability.
Loki does not index log contents, so only labels are searchable and the index stays small. That is the main difference in a Loki vs Elasticsearch comparison. Storage and indexing cost less than in a full-text search engine, and label design decides how much data each query reads. Free-text search across every field over long periods may suit a search engine better, so decide which questions people ask of logs before you choose labels.
Loki fits teams that already use Grafana for metrics and want logs beside them, platform teams collecting Kubernetes and infrastructure logs, and estates with large volumes and modest search needs. For release planning, the Loki GitHub releases page shows v3.7.11 as the latest stable release, dated 27 Nov 2026. It also lists v4.0.0-rc.6 as a pre-release, and no stable 4.x release appears there.
The default license of the repository is AGPL-3.0-only, per Loki licensing. That file lists several folders as Apache-2.0, including clients/, production/, tools/, pkg/push and pkg/util, and the vendor/ directory keeps its original upstream licenses. Grafana Labs relicensed Loki from Apache 2.0 in 2021. Running unmodified Loki internally is the common case. Review the license with counsel if you plan to modify Loki and offer it to others as a service.
Which components run behind a Loki cluster?
The same components run in every deployment mode. The modes differ in how those components are grouped into processes.
Distributor
Distributors validate incoming streams, enforce tenant rate and stream limits and forward valid streams to the ingesters responsible for them. They are stateless, so replicas can sit behind the gateway as write volume grows. Errors named rate_limited, per_stream_rate_limit and stream_limit return HTTP 429, which agents should treat as a signal to retry or to fix the source.
Ingester
Ingesters build chunks in memory, keep a write-ahead log on local disk and flush chunks and index files to object storage. The replication factor is generally 3, and quorum is floor(replication_factor / 2) + 1. The WAL is on by default, belongs on a mounted volume, and two ingesters must never share a WAL directory. Writes throttle at 90% disk usage by default.
Query path
The query frontend is optional. It splits large queries, queues them and caches results, and two replicas should suffice in most cases. Queriers read recent data from ingesters and older data from object storage. In larger clusters, index gateways serve the index in simple mode for all tenants or in ring mode, which shards indexes per tenant across instances.
Compactor and ruler
The compactor merges index files into one per day and tenant and applies retention and delete requests. It is usually run as a single instance. The ruler evaluates LogQL alerting and recording rules continuously and can integrate with Alertmanager. Watch the compactor closely, because both retention and deletion depend on it.
Which Loki deployment mode should you pick?
Scale figures come from the Loki deployment modes documentation and are guidance, so test with your own volumes.
| Mode | Documented fit | Status and notes |
|---|---|---|
| Monolithic | All components run in one process with -target=all. The docs say it suits small read and write volumes of up to approximately 20 GB of logs per day. | Supported. Loki monolithic mode is a sound start for small workloads. An HA monolithic deployment is one of the documented migration targets for simple scalable users. |
| Simple scalable | Work splits into write, read and backend targets. The write target runs the distributor and ingester, the read target runs the query frontend and querier, and the backend target runs the compactor, index gateway, query scheduler and ruler. It can scale close to a terabyte of logs per day. | Deprecated and removed with the Loki 4.0 release, so Loki 4.0 cannot run in this mode. New deployments should avoid it, and existing ones should plan a move. |
| Microservices | Each component runs as its own process. It is recommended for very large clusters and designed for Kubernetes. | Most efficient at scale and the most complex to set up and maintain. Plan autoscaling, caches and per-component monitoring. |
| Docker single binary | The Docker install runs Loki as a single binary on port 3100 for evaluating, testing or developing. The image runs as user loki with UID and GID 10001 by default. | Grafana recommends Helm or Tanka for production. BusyBox was removed from official images in 3.5.8, so containers no longer include /bin/sh. |
| Helm chart | Helm is the recommended install method in the Loki docs, which also list Tanka, Docker or Docker Compose, local binaries, source and Juju. | The chart is now maintained in grafana-community/helm-charts. The chart in the Loki repository continues for Grafana Enterprise Logs users. Pin a chart version. |
| Bloom query acceleration | Aimed at users who ingest more than 75 TB of logs per month. | Experimental, and not supported in single binary mode. Evaluate it only for very large estates. |
How do you design labels and avoid high cardinality in Loki?
Use labels for stable, bounded attributes such as cluster, namespace, application, environment and region. People select these first, and they keep the stream count manageable. Loki indexes only the label set of each stream, so every label you add widens the index, and every unique combination creates a stream. Start with a short list agreed with tenant owners, write it down as a label convention and apply it in the agent configuration. Labels are set at collection time, so changing them later means changing agents and starting new streams. Keep the same names across sources so one query pattern works for every team.
Every unique label combination creates a stream. The Loki label best practices suggest keeping variable labels to single digits or tens of values. Request IDs, user IDs and trace IDs as labels create many small chunks and a large index, which slows queries and raises storage cost. OTLP ingestion has a default index label limit of 15, and the docs warn that k8s.pod.name and service.instance.id are high-cardinality and no longer recommended as index labels by default. Check these defaults before you accept OpenTelemetry resource attributes as labels. Fix high-cardinality labels at the source.
When a high-cardinality value is needed in queries, attach it as structured metadata at the agent. It stays queryable without splitting streams. Structured metadata needs schema version 13 or higher and the tsdb index type, with defaults of 64 KB per log line and 128 entries per log line. It is enabled by default in Loki 3.0 and later and is required to ingest OTLP data. When a value is rarely queried, use a line filter or parser at query time. Decide for each field whether it becomes a label, structured metadata or a parsed field.
Set per-tenant limits for ingestion rate, streams and query size so one noisy source cannot degrade the cluster. per_stream_rate_limit defaults to 3 MB with a burst of 15 MB. Errors named rate_limited, per_stream_rate_limit and stream_limit return HTTP 429, so alert on 429 responses seen by agents. Review active streams with logcli after onboarding each source, and compare stream counts before and after. Loki Canary is a standalone app that emits and periodically queries logs to audit log capture and publishes Prometheus metrics, which gives a steady check on end-to-end health.
How do you set up Loki object storage and retention configuration?
Loki stores chunks and its index in object storage. Single Store TSDB is the recommended index store for Loki 2.8 and newer. The docs list Amazon S3, Google Cloud Storage, Azure Blob Storage, IBM Cloud Object Storage, Baidu Object Storage and Alibaba OSS as supported and recommended chunk stores. S3-compatible storage such as MinIO is supported but not typically recommended for production, so check its performance and support before you rely on it for an on-premises S3 config. Loki 3.6.0 moved the AWS SDK from v1 to v2 for S3 with no user-facing configuration change.
Retention is off by default. Set compactor.retention_enabled to true. The value of limits_config.retention_period defaults to 0s, which keeps logs indefinitely. Retention also requires a delete_request_store and a 24h index period, and the compactor must run as a single instance. Set a global retention_period, override it per tenant, and use retention_stream rules with label selectors. Each stream period must be at least 24h, selectors accept only label matchers, and a higher priority value wins, with the shorter period winning a tie. Retention is not retroactive, and compactor.retention_delete_delay defaults to 2h. The Loki retention with the compactor page covers each setting.
If you use an object store lifecycle policy, its expiration must be longer than the Loki retention period, and a lifecycle rule must never use an empty prefix. Otherwise the index can point at missing chunks. For backup, rely on object storage versioning or replication for chunks and index files, and keep Loki configuration and runtime overrides in version control. The ingester write-ahead log covers short gaps between flushes. With the WAL enabled, rollouts and scale-downs skip flushing to the chunk store unless --ingester.flush-on-shutdown=true is set.
How does Loki multi-tenancy work with X-Scope-OrgID?
Loki runs with auth_enabled: true by default and requires an X-Scope-OrgID header on every request. A request without it fails with HTTP 401 and the message no org id. With auth_enabled: false, Loki uses a single tenant with the ID fake and does not require the header. The Loki multi-tenancy page describes both modes.
Loki has no included authentication layer. An authenticating reverse proxy or gateway in front of it must verify the caller and set the tenant header. The Helm chart ships a default nginx reverse proxy for routing and authorization, as described in Loki authentication. Agents that push logs and Grafana data sources that query them should each have their own credentials at that gateway.
Map tenants to the boundaries that matter for access and retention, such as business unit, environment or regulated workload. Tenant IDs can be at most 150 bytes, a colon is not valid, and . and .. are not valid. Cross-tenant queries need multi_tenant_queries_enabled: true in the querier configuration, which defaults to false, and tenants are separated by the pipe character in X-Scope-OrgID. Push, tail and OTLP endpoints reject more than one tenant with HTTP 400. Grafana data source permissions then decide which users reach which tenant.
Grafana Enterprise Logs adds tenant management through an API or plugin, token-based authorization, label-based access controls and cross-tenant queries, and it is compatible with OSS Loki. Weigh that against a gateway you operate when you compare Grafana Enterprise Logs and Loki. Logs often contain personal data, tokens and internal hostnames. Filter or redact at the agent, protect object storage credentials, encrypt traffic between agents, gateway and Loki, and restrict who can submit delete requests.
How do you handle Promtail end of life and migrate to Alloy?
Promtail reached end of life on March 2, 2026, and the Loki Promtail docs say you must migrate to Grafana Alloy or another supported client. The Alloy migration docs include a tool to convert Promtail configuration. The Loki 3.7 release notes say Promtail was deprecated in Loki 3.0 and removed in 3.7.3, and that lambda-promtail was not removed. Standardize on one agent per platform and keep its configuration in version control, since labels are set at collection time.
Loki accepts OTLP logs at the /otlp path, so OpenTelemetry collectors can send directly. Structured metadata is required to ingest OTLP data and is enabled by default in Loki 3.0 and later. Review the default OTLP index label limit of 15 and the attributes mapped to labels before you enable a new source.
When moving from an Elasticsearch, OpenSearch or Graylog stack, inventory sources, retention rules, saved searches, dashboards and alerts. Decide which fields become labels, which become structured metadata and which are parsed at query time. Rewrite saved searches and alerts in LogQL and run both systems in parallel for an agreed period before retiring the old one.
The Loki Helm chart was forked to grafana-community/helm-charts effective March 16, 2026, per the Loki v3.7 release notes. Pin a chart version and read its upgrade notes before moving between major chart versions. The Loki upgrade guide advises staying current and upgrading sequentially, testing in development when skipping versions, and validating a Loki 3.0 config with -verify-config=true. The Loki release cadence page says weekly releases carry no stability guarantees, so run stable releases in production.
Who owns Loki operations?
Loki cost and performance depend on the sources sending to it, so ownership covers both the platform and its tenants.
Platform team
- Runs Loki, caches, gateway and object storage.
- Watches ingestion errors, flush failures and query latency.
- Plans the move off simple scalable mode before Loki 4.0.
Tenant owners
- Agree labels, retention and limits for their sources.
- Fix high-cardinality labels.
- Own their dashboards and alert rules.
Security and privacy
- Define redaction rules for agents.
- Approve tenant boundaries and cross-tenant access.
- Review delete requests for regulated logs.
Change record
- Keep Loki and agent configuration in version control.
- Record chart and Loki versions per change.
- Log retention changes with approver and date.
Grafana Loki deployment questions
How does Loki compare with Elasticsearch for logs?
Loki indexes only the label set of each stream and stores log lines as compressed chunks in object storage, so the index stays small and costs stay low. A full-text search engine indexes contents, which supports free-text search across every field. Choose Loki when people find logs by source, such as cluster, namespace or application, and then filter lines. Choose a search engine when long-period free-text search across all fields is the main need. List the questions people ask of logs first.
How do we install Loki with the Helm chart?
The Loki docs list Helm as the recommended install method, ahead of Tanka, Docker, local binaries, source and Juju. The chart is now maintained in grafana-community/helm-charts, effective March 16, 2026, and the chart in the Loki repository continues for Grafana Enterprise Logs users. Pin a chart version, read upgrade notes before major moves and validate configuration in development. The chart ships a default nginx reverse proxy for routing and authorization.
How do we configure Loki retention?
Set compactor.retention_enabled to true, add a delete_request_store and use a 24h index period. Then set limits_config.retention_period, which defaults to 0s and keeps logs indefinitely. Add per-tenant overrides or retention_stream rules, each at least 24h. Run the compactor as a single instance. Chunks leave the index first and are deleted after retention_delete_delay, which defaults to 2h. Retention is not retroactive, and any bucket lifecycle rule must expire objects later than Loki does.
Is Loki simple scalable mode deprecated?
Yes. Simple scalable deployment mode is being deprecated and will be removed with the Loki 4.0 release, so Loki 4.0 cannot run in that mode. It still runs today. Plan a move to microservices mode or an HA monolithic deployment, and test it with production-like volumes. The latest stable release is v3.7.11, and v4.0.0-rc.6 is listed as a pre-release, so there is time to plan and rehearse the change.
How do we fix high-cardinality labels in Loki?
Remove values such as request IDs, user IDs and trace IDs from the label set at the agent, because each unique combination creates a stream. If queries still need the value, send it as structured metadata, which needs schema version 13 or higher and the tsdb index type. Otherwise use a line filter or parser at query time. Review active streams with logcli after each change and set per-tenant stream limits.
What replaces Promtail after its end of life?
Grafana Alloy replaces it. Promtail reached end of life on March 2, 2026, and the Alloy migration docs include a tool to convert Promtail configuration. Loki also accepts OTLP logs at the /otlp path, so OpenTelemetry collectors can send directly. Keep one agent per platform, store its configuration in version control and rebuild label rules deliberately, since labels are set at collection time.
When does Grafana Enterprise Logs make sense instead of OSS Loki?
OSS Loki has no included authentication layer, so you run a gateway that verifies callers and sets the tenant header. Grafana Enterprise Logs adds tenant management through an API or plugin, token-based authorization, label-based access controls and cross-tenant queries, and it is compatible with OSS Loki. Compare those features with the effort of operating your own gateway and access rules before you choose.
What does a Loki deployment cover and what do you receive at handover?
Effort depends on daily log volume, the number of sources and tenants, retention requirements, the object storage platform, the deployment mode, migration from an existing log stack and redaction needs. Label design and source onboarding usually take more time than installing Loki.
DeployOpen sizes and deploys Loki in your environment, configures object storage, retention and tenant limits, puts an authenticating gateway and Grafana SSO in front, rolls out Alloy or OpenTelemetry agents, migrates saved searches and alerts, and documents upgrades.
Handover includes label conventions, the tenant and retention map, agent configurations, a restore test record and the Loki 4.0 upgrade plan. You keep the infrastructure, the configuration and the records needed to run Loki without DeployOpen.
Sources and further reading
- Loki deployment modes ↗
- Loki retention with the compactor ↗
- Loki label best practices ↗
- Loki licensing ↗
- Loki GitHub releases ↗
- Loki GitHub README ↗
- Loki authentication ↗
- Loki multi-tenancy ↗
- Loki install ↗
- Loki Docker install ↗
- Loki Helm install ↗
- Loki v3.7 release notes ↗
- Loki release cadence ↗
- Loki Promtail docs ↗
- Loki upgrade guide ↗

