Per-tenant limits in Loki: when a shared cluster needs separate guardrails
When one Loki cluster serves several teams, environments or customers, a single noisy tenant can consume ingestion capacity, create too many streams or run heavy queries that slow everyone else. Per-tenant limits are the control that stops this: they let you set ingestion rate, stream count, query limits and retention separately for each tenant, so each group gets its own guardrails inside the same cluster. Multi-tenancy only works when auth_enabled is set to true, because Loki then identifies the tenant of every request from the X-Scope-OrgID header. Without that setting, Loki runs as a single tenant and per-tenant limits have nothing to apply to.
Limits are defined in two layers. The limits_config block sets the default values for every tenant, and per-tenant overrides replace those defaults for named tenant IDs. Before you write any override, list the tenants you expect, the approximate log volume and stream count each one produces, and which tenants must be protected from which others. Confirm the exact limit names and their units against the Loki configuration reference for your release, because the set of available limits and their defaults change between versions. Also decide who may change limits and how changes are reviewed, since a limit raised for one team affects the capacity every other team shares.
The per-tenant overrides file is loaded through the runtime_config feature, which means you can change tenant limits without restarting Loki. The optional overrides exporter exposes both default and per-tenant limits as Prometheus metrics, so you can check what each tenant is actually allowed and compare it with observed usage. Grafana recommends running one overrides exporter instance per cluster, and that instance should be scraped by your own monitoring. Test the full cycle in a non-production cluster first: edit the file, confirm the new value appears in the exported metrics, and confirm that a tenant over its limit receives the rejection you intended.
Which limit to set per tenant and when each fits
This table compares the four per-tenant controls available for a shared Loki cluster: ingestion rate, stream count, query limits and retention. Read each row for the failure it prevents, the workload it suits and what to confirm in the documentation for your Loki version. The main takeaway is that limits protect the cluster from one tenant's spikes, while retention controls how long data is kept.
| Limit | Failure it prevents | Workload it suits | What to confirm for your version |
|---|---|---|---|
| Ingestion rate | One tenant's log bursts crowd out ingestion for every other tenant on the cluster. | Tenants with predictable daily volume or known bursts, such as a batch job or a noisy service. | The rate and burst parameter names, their units and whether they are applied per distributor or per cluster. |
| Stream count | A tenant creating many unique label combinations inflates the index and slows writes and queries for everyone. | Tenants whose label sets are controlled by a few services, or tenants where label mistakes are likely. | The maximum streams limit name, its default, and how the limit interacts with structured metadata and label cardinality guidance. |
| Query limits | One dashboard or script runs queries that scan too much data or run too long and starve other users. | Tenants with heavy Grafana usage, scheduled reports or alerting queries that scan wide time ranges. | Limits on query length, parallelism, series and bytes scanned, and whether each applies per tenant through overrides. |
| Retention | Logs are kept indefinitely because retention is disabled by default, which raises storage cost and extends the data subject to deletion or access requests. | Tenants with a defined legal, contractual or operational retention period, including per-environment differences. | That retention is enabled, the compactor is running, and the per-tenant or per-stream rule syntax. Each stream rule must be at least 24 hours. See the retention rules section. |
How to set up per-tenant limits step by step
This sequence turns a multi-tenant Loki cluster into one where each tenant has its own ingestion and query limits, changeable at runtime, and where you can prove the limits are enforced before real teams depend on them.
Confirm multi-tenancy is enabled
Set
auth_enabled: truein the Loki configuration so the cluster treats every request as belonging to a tenant identified by the X-Scope-OrgID header. Your platform or observability engineer makes this change in the config file and restarts or rolls the Loki components. Done means a request sent without the header is rejected, while a request with a tenant ID is accepted. Confirm the exact key names and header behavior against the Loki version you run, since the multi-tenancy documentation is the reference for that release.Define the default limits
Under
limits_config, set the defaults that apply to every tenant that has no override: ingestion rate, burst size, stream limits, query limits and retention settings. Choose values from your measured daily volume and expected stream count, and record the reasoning so reviewers can see why each number was picked. Done means the configuration loads cleanly and the Loki components report the defaults on their startup or config endpoints. Confirm every limit name and unit against the documentation for your version.Create the overrides file with tenant entries
Create a runtime overrides file that lists each tenant ID as a top-level key, with only the limits that differ from the defaults under that key. Keep tenant IDs identical to the values your proxy sets in X-Scope-OrgID. Store the file in version control so every change has an author and a review. Done means the file parses as valid YAML and every tenant ID matches an ID you expect to see in incoming traffic. Confirm the expected file structure for your version.
Enable runtime configuration
Point the Loki configuration at the overrides file through the
runtime_configsettings, including the file path and the reload interval. Once this is in place, edits to the overrides file are picked up by the running cluster without a restart. Done means that after you change one tenant's limit, the new value appears in the cluster's effective configuration within the reload interval, and no component restarted. Confirm the reload behavior and key names against your version's documentation, and make sure the file is mounted or shared identically to every component that enforces limits.Expose limits with the overrides exporter
Enable the optional overrides exporter so default and per-tenant limits are published as Prometheus metrics. Grafana recommends running one instance per cluster, so deploy it once and scrape it with your existing Prometheus setup. Done means the metrics for each tenant appear in Prometheus and match the values in the overrides file. Use these metrics to build a dashboard or alert that shows each tenant's configured ceiling next to its actual usage.
Verify with an accepted test push
Send a small test push with a tenant ID that has a known limit, using a tool such as
logclior a direct push to the HTTP API. Keep the payload well under the tenant's ingestion limit and check that Loki accepts it and that the stream is queryable under that tenant only. Done means the push succeeds and a query with the same tenant header returns the line, while a query with a different tenant header does not. Record the request, the response and the time so the test can be repeated after each change.Verify with a rejected test push
Send a push deliberately above the tenant's configured limit, such as a burst of lines exceeding the rate you set, or a stream count above the cap. Done means Loki rejects or rate-limits the excess with the error response you expect for that limit, and the rejection shows up in the relevant metrics. Then edit the overrides file to raise that tenant's limit, wait for the reload, and repeat the push to confirm the change took effect without a restart. Confirm the status codes and error messages against your version's documentation.
How requests, defaults and overrides fit together
The diagram starts with a client sending a request that carries the X-Scope-OrgID header to an authenticating reverse proxy, which must sit in front of Loki because Loki has no built-in authentication. Loki then checks the tenant's effective limits, which come from the defaults and the runtime overrides file, and accepts or rejects the request. The overrides exporter reads the same limits and exposes them to Prometheus, so the values you see in metrics should match the file you edited. Check that the proxy sets the tenant header and that the exporter reports the limits you expect for each tenant.
Requests pass through a proxy, then Loki checks tenant limits that the exporter also exposes.
Security and operational risks of per-tenant limits
Per-tenant limits sit at the boundary between who can reach a tenant and how much that tenant may consume. The risks below cover authentication at the edge, the overrides file itself, how changes are governed and what limits can and cannot do for cluster capacity.
Tenant identity comes from the proxy
Loki has no built-in authentication layer, so the authenticating reverse proxy must set or strip the X-Scope-OrgID header on every request. If a client can send its own tenant ID, it can read another tenant's data or be charged against another tenant's limits. Check that the proxy overwrites the header for every route, including health and push endpoints, and test a request that carries a forged tenant ID.
Loki authentication docsWrong overrides fail silently
A typo in a tenant key or a limit value can leave a tenant on defaults without any error at the point of the change. The result is either a tenant that is throttled during a production incident or one that is allowed to flood the cluster. Confirm after each change that the expected limit is visible in the overrides exporter metrics for that tenant, and watch for ingestion rate-limit errors from that tenant's clients.
Limit changes need change control
Raising a tenant's ingestion rate or stream count is a capacity decision, not only a configuration edit. Route overrides changes through the same review and approval path as other production changes, and record who requested the change, the reason, the old and new values and the rollback value. Review changes in the file history so that a loosened limit does not persist unnoticed after the original need has passed.
Restrict access to the overrides file
The overrides file is a control point for every tenant on the cluster, so write access should be limited to the few people and automation that manage Loki configuration. Store it under version control with protected branches, keep the deployment credentials that can replace it separate from those used by applications, and log every modification. Read access may also reveal tenant names and internal sizing, so treat it as internal configuration.
Overrides exporter docsLimits do not replace capacity planning
Per-tenant limits protect the cluster from individual tenants, but they cannot add ingesters, object storage throughput or query capacity. If the sum of the limits granted across tenants exceeds what the cluster can serve, the cluster will still degrade at peak. Plan capacity from the combined limits and observed load, and treat per-tenant limits as the mechanism that decides who gets squeezed first.
Test changes in a non-production cluster
Runtime overrides apply without a restart, which makes a bad value take effect across live traffic within moments. Before changing limits in production, apply the same overrides file in a non-production Loki cluster with representative tenants and replay a realistic push and query pattern. Confirm that rejected requests return the errors you expect and that the exporter reports the values you intended.
Monitoring the effective limits with the overrides exporter
The overrides exporter is an optional Loki module that publishes the default and per-tenant limits as Prometheus metrics, so you can see the limits Loki is enforcing rather than inferring them from the runtime file. Grafana recommends running one instance per cluster, which keeps the metric series for limits from being duplicated across scrapes. Enable it as its own target in your deployment, point Prometheus at it, and confirm the exact metric names and label set in the documentation for the Loki version you run before you write any dashboard or alert that depends on them, because names can change between releases. The Loki overrides exporter documentation is the reference to check against.
Once the metrics are scraped, the useful work is comparison. For each tenant, place the configured limit beside the observed value from Loki's own ingestion and query metrics, such as active streams, bytes ingested per second and the share of a rate limit in use. A tenant consistently near its ceiling needs a decision: raise the override in the runtime file with a recorded reason, or work with that team to reduce stream cardinality. A tenant far below its limits may be carrying a stale override that no longer reflects its needs. Keep the comparison in a dashboard that the platform team reviews on a fixed schedule, not only during incidents.
Alerts should fire on the gap between configured limits and usage, not on absolute numbers alone. Set a warning threshold below each limit so the platform team has time to act before ingestion is rejected, and route limit-rejection alerts to the owners of the affected tenant. Test each alert by temporarily lowering a limit in a non-production cluster and confirming the metric moves, the alert fires and the notification reaches the right people. Confirm with your own environment which metrics your Loki version exposes for rejected requests, since the names you alert on must match what your cluster actually emits.
Limits and what to confirm in your environment
Per-tenant limits only protect a cluster if the values match your Loki release, your deployment mode and your sizing. The cards below list what to confirm before you rely on the overrides file, the exporter and the retention settings that sit beside them.
Limit key names and defaults
Limit keys and their default values change between Loki versions, so a key that works in one release may be ignored, renamed or behave differently in another. Read the limits reference for the exact release you run, then write your overrides against that version. Test each key in a non-production cluster and confirm the effective value through the metrics the exporter publishes. Record the release and the key names in your change records so an upgrade does not silently change tenant behavior.
Overrides exporter docsRuntime reload of the overrides file
Loki applies tenant limit changes without a restart through the runtime configuration feature, so you can adjust one tenant's ingestion rate or stream count while others keep writing. Confirm that your deployment mounts the runtime file where every component that enforces limits can read it. Check how your configuration management writes the file, because a partial or malformed write can leave a tenant with unexpected limits. Keep the last known good file under version control.
Overrides exporter placement
The overrides exporter is optional, but Grafana recommends running one instance per cluster. It publishes default and per-tenant limits as Prometheus metrics, which lets you alert when a tenant nears a limit before writes start failing. Confirm which Prometheus instance scrapes it, that the scrape does not duplicate across replicas, and that dashboards show the defaults alongside each override so reviewers can see what a tenant inherits.
Tenant headers through your proxy
Per-tenant limits only work if each request carries the correct X-Scope-OrgID header. Confirm how your reverse proxy sets or strips that header in your deployment mode: monolithic, simple scalable or microservices. Simple scalable mode is being deprecated and will be removed with the Loki 4.0 release, so plan for a different topology if you expect to run Loki 4.0. Test that a client cannot send a header that changes its tenant.
Multi-tenancy docsSizing sets the real ceiling
A per-tenant limit can only allow traffic that the cluster can ingest and query. Raising a tenant's ingestion rate on an undersized write path moves the failure to other tenants and to the backing store. Confirm the write, read and backend capacity against your expected log volume and query load before you raise any limit. Ask for a load test that includes several tenants writing and querying at once, not one tenant at a time.
Retention depends on the compactor
Per-tenant retention is applied by the compactor, and retention is disabled by default, so logs are kept until retention is explicitly enabled. Confirm that the compactor runs, has write access to the object store, and that the retention settings you set per tenant are the ones it reads. Each stream rule must be at least 24 hours. Verify deletion on a test tenant before you rely on it for an audit or privacy requirement.
Retention docsQuestions teams ask before setting per-tenant limits
Can per-tenant limits in Loki change without restarting the cluster?
Yes. Loki applies tenant limit changes without a restart through its runtime configuration feature, so limits are read from a runtime overrides file that Loki reloads while it runs. Changes still need to be written to that file and checked, so the change process matters more than the restart. Confirm the exact runtime_config settings for your Loki version in the Loki overrides exporter documentation before you plan the change workflow, and test one tenant's change in a non-production cluster first.
Can our own team set per-tenant limits, or do we need outside help?
Your team can set them if it already runs Loki, owns its configuration and has a review process for changes. The work is mostly defining which limits each tenant needs, writing the overrides file, and proving each change behaves as intended. Outside help is useful when many tenants have different limits, when the proxy and authentication layer must set tenant IDs correctly, or when you need monitoring and documentation that auditors can read. A partner would work from a written scope, which sets the deliverables and the points where your team takes over.
What makes the effort of per-tenant limits larger or smaller?
The main drivers are the number of tenants, the number of limit types you override, how tenant IDs reach Loki through your reverse proxy and authentication layer, and how much monitoring you build around the result. Each added tenant adds a set of values to define, review and test. Each limit type, such as ingestion rate, stream count, query limits or retention, adds rules to explain to the owners of each tenant. Proxy and identity integration adds the most risk when several teams share one gateway. A written scope should list each of these drivers with a count so you can compare quotes.
What does the work need from our environment and staff?
The work needs read and change access to the Loki configuration and the runtime overrides file, access to the authenticating reverse proxy that sets the X-Scope-OrgID header, and access to the Prometheus instance that will scrape the overrides exporter. It also needs a named owner for each tenant who can approve limit values, and a change control process that records who changed what and when. Ask for a list of these access requirements in the written scope so that security and platform teams can approve them before work starts.
Can we set retention separately for each tenant?
Yes, Loki retention can be applied globally, per tenant or per stream selector, and the compactor applies it. Retention is disabled by default, so logs are kept indefinitely until retention is enabled. Each stream rule must keep logs for at least 24 hours. Before you set different periods per tenant, decide which teams or customers have legal or contractual retention needs, because changing retention later does not restore deleted data. Confirm the exact configuration keys for your Loki version in the Loki retention documentation.
How do we confirm that a new limit actually took effect?
Check the value in two places. First, query the overrides exporter metrics in Prometheus to confirm the default and per-tenant values match what you intended. Second, send a test workload from that tenant and confirm the limit is enforced, for example by checking that requests above the ingestion rate are rejected and logged as limit errors. Record both checks in your change ticket. Reviewing the exporter output after every change catches typos in tenant names, which otherwise leave a tenant on default limits without any visible error.
How much will per-tenant limits cost, and how long will they take?
Cost and duration depend on the tenant count, the limits in scope, the proxy and identity work, and the monitoring you need, so no fixed figure applies. Ask for a fixed-scope written quote that lists each deliverable, the environments covered, the access you need from your team, and the acceptance checks. Ask separately what recurs after handover, such as reviewing limits when tenants grow, and whether ongoing support is a retainer. DeployOpen does not publish a price list, so the written scope is the basis for the quote.
How DeployOpen scopes and delivers per-tenant limits for Loki
DeployOpen plans per-tenant limits as part of the wider Loki tenancy design, so each team, environment or customer gets ingestion, stream, query and retention settings that match its agreed use. The work covers the overrides file, the runtime configuration that applies it, and the metrics that show what each tenant is actually using in your infrastructure.
How we scope
- Confirm the tenant list, the owner of each tenant and the limits each owner has agreed to
- Map which limits need per-tenant values and which stay at cluster defaults
- Record the written scope, deliverables and timeline before any configuration changes begin
- Agree whether ongoing support and upgrades will be covered by a retainer after handover
How we build
- Write the default and per-tenant overrides file and enable runtime configuration in your Loki deployment
- Test limit changes in a non-production cluster to confirm they apply without a restart
- Deploy the overrides exporter and build dashboards and alerts for usage against each tenant limit
- Check that tenant IDs, limit values and retention settings match the approved scope
How we hand over
- Deliver the overrides file, configuration changes and a document describing each limit and its owner
- Provide a runbook for adding a tenant, changing a limit and rolling back a bad value
- Walk your platform and operations teams through the metrics, alerts and change process
- Document the test results and the remaining items to confirm with your own environment
How we support
- Review tenant usage against limits on a schedule agreed in the written scope
- Adjust overrides when teams or customers change their requirements through a controlled change process
- Plan Loki upgrades so override settings and metric names are checked before rollout
- Offer ongoing support, upgrades and continuous testing as a retainer if your team wants them

