Designing Loki tenants for teams and environments starts with one question
A tenant is the isolation boundary in Loki for data, limits and retention, so the design decision is what each tenant represents before the first log line is shipped. Decide whether a tenant maps to a team, an environment such as production or staging, or a customer, and settle that choice before ingestion starts, because changing it later is expensive. You are deciding how to split logs in one self-hosted cluster, and every later control (per-tenant limits, retention, query access) attaches to that split.
Loki is multi-tenant only when auth_enabled is set to true. In that mode it identifies the tenant on every request from the X-Scope-OrgID header. Loki has no built-in authentication, so the authenticating proxy in front of it must set that header based on who the caller is. That means the proxy, not the client shipping logs or the Grafana user, is the place where tenant identity is trusted. Confirm early which component will own that mapping, how it will handle agents that send logs directly, and whether your identity provider can supply the attribute the proxy needs. The Loki multi-tenancy documentation describes the header and isolation model in detail.
Teams usually need separate tenants when logs have different owners, different retention obligations or different people allowed to read them. Separating environments is common when production logs must be kept longer or queried by fewer people than development logs. Separating customers only makes sense when you run one cluster for several external organizations, and that case carries stricter isolation expectations. If your split does not match any of these, you probably need labels, not tenants. Write down the owner, retention period and reader group for each candidate tenant, then check that the split holds before you configure anything.
What should a tenant represent?
A Loki tenant is the unit that holds data, limits and retention, and the X-Scope-OrgID header is how requests are assigned to one. Choosing what a tenant stands for decides how isolation, per-tenant settings and access control behave later. Each option below trades isolation against operational overhead and query noise.
One tenant per team
Each engineering or operations team gets its own tenant, so its logs, ingestion limits and retention can differ from other teams. This fits organizations where teams own their applications and want to query only their own data. The trade-off is that a service shared by several teams has to be assigned to one tenant, and cross-team incident searches need multiple tenants or a cross-tenant tool. Check how many teams will need access to each tenant before you start.
Loki multi-tenancy docsProduction versus non-production
Production and non-production environments are split into separate tenants, so a noisy test deployment cannot consume the ingestion budget or query capacity used for production incidents. Retention can be shorter for non-production data, which is a common reason to split along this line. Teams then need a clear rule for which tenant a shared service writes to, and engineers must know which tenant to query during an incident.
One tenant per customer
When one Loki cluster stores logs for several customers, each customer gets a tenant so that limits, retention and queries stay separated. This is the strongest logical separation of the four options, but it only holds if an authenticating proxy maps each customer's credentials to the correct tenant ID. Confirm that customer data cannot reach another tenant through any path, including Grafana data source settings.
One shared tenant
All sources write to a single tenant, which means one set of limits, one retention period and one query pool. It is the simplest layout to run and suits a small cluster with one owning team. Access control then has to be handled by label selectors or by the proxy, since the tenant itself offers no separation. Expect heavier query contention and broader result sets as the number of users grows.
Tenant is not a security boundary by itself
A tenant ID is a routing label, not an authentication control. Loki has no built-in authentication layer, so any client that can reach Loki can set any X-Scope-OrgID value unless a reverse proxy authenticates the user and sets the header itself. Before choosing a tenant model, confirm which proxy will strip client-supplied tenant headers, which identity provider will issue user identities, and who is allowed to change the mapping.
Loki authentication docsTenant ID rules and why length matters
A Loki tenant ID must not exceed 150 bytes, and it must use a restricted character set. The 150-byte figure is the hard ceiling, not the target. Grafana recommends a reasonable limit such as 20 bytes, and that is the number to design around. Before you name anything, check the allowed characters in the multi-tenancy documentation for the Loki version you run, because the character rules are the part teams most often assume incorrectly. Pull the exact rule from the docs at Loki docs: Manage tenant isolation rather than copying a rule of thumb from another system.
Length matters because the tenant ID is not just a value in a config file. It appears in the X-Scope-OrgID header on every request from Grafana, Alloy, the ruler and scripts, and it shows up in dashboard data source settings, datasource provisioning, runbooks, alert annotations and audit trails. A short, stable, descriptive ID such as payments-prod or platform-stg stays readable in all of those places and is easy to type correctly in a hurry during an incident. A long ID with dates, project codes or nested path segments makes every header and dashboard harder to scan, and it raises the chance of a copy error that sends queries to the wrong tenant.
Stability is the other half of the decision. Choose IDs that describe a long-lived boundary, such as a team, environment or customer, and avoid names tied to people, hosts or temporary projects that will change. Write the chosen IDs into your naming standard before the first ingester starts, because renaming a tenant on a cluster that already holds data is not a configuration edit. Ask your platform team to record which IDs each collector, proxy and dashboard uses so a future change can be scoped and tested.
Single-tenant mode and the fake tenant
With auth_enabled: true, Loki treats every request as belonging to a tenant. The tenant is identified by the X-Scope-OrgID header, and Loki keeps each tenant's streams, indexes and limits separate. A request without the header is rejected, so every shipper, Grafana data source and API caller must send a tenant ID. This is the mode to choose when more than one team, environment or customer will share the cluster and you expect those groups to see different data.
- Headers are mandatory: Agents such as Grafana Alloy must set the tenant header on every push, and each Grafana data source must send the matching header on every query.
- Isolation is by tenant: Per-tenant retention, limits and queries apply to each ID, which is what makes later separation possible without rebuilding the cluster.
- Authentication still sits outside Loki: Loki does not check passwords or tokens in this mode. You need an authenticating reverse proxy in front of it to decide who may send which tenant ID.
- Clients need configuration: Plan the header in deployment templates so that no team ships logs without a tenant ID.
- Tenant ID rules apply: Choose short, stable IDs now, because renaming one later means migrating data.
Before you commit, confirm with your team who will own the proxy that sets the tenant header and how that proxy will be tested.
With auth_enabled: false, Loki runs as a single tenant and does not require the X-Scope-OrgID header. All data is stored under one tenant ID, which defaults to fake. You can change that ID with the no_auth_tenant setting. This mode removes the header requirement, so a quick test or a single-team install can start with fewer moving parts and no tenant configuration in every client.
- No header needed: Shippers and Grafana data sources work without tenant configuration, which keeps the first setup simple.
- One shared dataset: Anyone who can reach the query endpoint can read every stream, so the mode offers no separation between groups.
- Default name is visible: The
fakename appears in storage paths and tooling, so changeno_auth_tenantto a meaningful name if the data will live for any length of time. - Limits are global: Per-tenant limits and retention cannot distinguish groups because there is only one tenant.
- Changing the ID later is costly: Once the cluster holds data, changing
no_auth_tenantrequires a data migration.
Before you choose this mode, confirm that the single tenant will never need to serve a second team or customer on the same cluster.
Single-tenant mode suits a short-lived test environment, a proof of concept, or a deployment owned by one team that reads all of its own logs. In those settings the cost of the header and proxy work may outweigh the benefit, and the operators are the same people who read the data. The mode also makes it easier to validate that the storage backend, the shipper and Grafana connect correctly before you add authentication and tenancy.
- Proof of concept: Use it to confirm object storage, ingestion and query paths before designing the production layout.
- Single owner: One team that operates the cluster and reads every stream has no need for tenant boundaries.
- Low-risk data: Logs with no sensitive content and no separation requirement carry little exposure in one tenant.
- Quick feedback: Fewer configuration points make early troubleshooting faster.
- Clear exit plan: Record the conditions that would trigger a move to multi-tenant mode, such as a second team or a customer onboarding.
Before relying on single-tenant mode, confirm that no one outside the owning team will ever need access, and that the production migration path to tenant IDs is documented.
Single-tenant mode is easy to start with, but it is a poor foundation when the cluster is expected to grow into several teams, environments or customers. Each new group will either share the same visible data or need a separate cluster, and retrofitting tenant IDs means changing every client, proxy and dashboard, then migrating the data that already sits under the old tenant. The work grows with the amount of stored history, so the cost of waiting rises over time.
- Data migration required: Changing the tenant ID on a cluster that holds data needs a migration, so the default ID becomes a lasting decision.
- Client changes everywhere: Every shipper and data source must be updated and retested at the same time.
- Retention and limits cannot split: Per-tenant retention and limits require tenants to exist before the data is written.
- Access review gets harder: Auditors may ask who could see which logs, and a single tenant gives one answer for all groups.
- Design decisions are deferred: Tenant naming, proxy design and access rules are postponed rather than made.
Before leaving single-tenant mode, ask your team to estimate the migration work with the data volume and client count they actually have.
Tenant design options and when each fits
This table compares five ways to map a Loki tenant ID to your organization, from one shared tenant to per-customer tenants. Read each row for what the tenant stands for, how fine-grained isolation and limits can be, what it costs to operate, and the situations where it fits. The main takeaway is that the tenant boundary is hard to move later, so choose it against the access and limit decisions you expect to make.
| Option | What the tenant represents | Isolation and limit granularity | Operational cost | When it fits |
|---|---|---|---|---|
| Single fake tenant | One shared tenant, with auth_enabled set to false and the default ID fake unless no_auth_tenant changes it | No separation between users or teams; limits and retention apply to everything at once | Lowest: no proxy, no per-tenant configuration | Small single-team deployments or lab use where everyone may read all logs |
| Team tenant | One tenant per engineering, operations or security team | Separate retention and limits per team; access can be split by team at the proxy | Moderate: one tenant ID per team to create, route and monitor | Organizations where teams own distinct services and rarely need each other's logs |
| Environment tenant | One tenant per environment such as production, staging and development | Separate retention and limits per environment; production logs can be kept longer or read by fewer people | Moderate: few tenants, but cross-environment incident work needs multi-tenant queries | Organizations that keep production logs under stricter access or retention than non-production |
| Customer tenant | One tenant per customer of a software or service provider | Strongest separation between customers; per-customer limits and retention | Higher: a proxy must map customer credentials to tenant IDs and usage must be tracked per customer | Providers hosting logs for several customers in one cluster, where data separation is a contract or audit concern |
| Hybrid (environment plus team) | A tenant ID per combination, such as production-payments or staging-platform | Finest split of the options shown; more limits and retention rules to maintain | Highest: tenant count grows with teams times environments, and dashboards must target the right ID | Large organizations with strict production controls and team ownership, where the extra administration is justified |
Tenant headers are set at the proxy, never by the client
The diagram starts with Grafana Alloy and Grafana users on the left, outside the trust boundary. Every request passes through the authenticating reverse proxy, which checks the caller and writes the X-Scope-OrgID header, so the proxy is the only place the tenant is assigned. Loki's write and read paths then use that tenant to scope data in object storage. Check that clients cannot reach Loki directly and that the proxy strips any X-Scope-OrgID header sent by the caller.
Tenant assignment happens at the proxy before any Loki component sees the request.
How to set up tenants before the first ingest
This sequence fixes the tenant model, the authentication settings, the proxy identity mapping and the shipper configuration before any logs arrive, so each tenant's data is isolated from the start.
Define the tenant model and naming rules
Decide whether a tenant represents a team, an environment or a customer, then write down the ID format before any configuration exists. Keep IDs short and within the allowed character set, since Loki tenant IDs must not exceed 150 bytes and Grafana recommends a reasonable limit such as 20 bytes. Assign one owner who approves new IDs. The output is a signed-off tenant register listing each ID, its owner and its purpose. Check it by confirming that every planned source has exactly one tenant ID in the register.
Set auth_enabled and the no_auth_tenant
Set auth_enabled to true in the Loki configuration so requests are multi-tenant and the X-Scope-OrgID header identifies the tenant. If you run a single-tenant cluster instead, keep auth_enabled at false and set no_auth_tenant only if the default fake ID is unsuitable. Make this decision before the first ingest, because changing the tenant ID on a cluster that already holds data requires a data migration. Check it by restarting the test cluster and confirming that a write without the header is rejected in multi-tenant mode.
Put an authenticating proxy in front of Loki
Loki has no built-in authentication layer, so place a reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. The proxy authenticates each user or service, looks up the tenant ID that identity is allowed to use, and sets X-Scope-OrgID on the forwarded request. Clients should never be able to set this header themselves on the public path. Check it by sending a request with a valid identity for one team and confirming the proxy forwards only that team's tenant ID.
Configure shippers to send the correct tenant
Configure each log shipper, such as Grafana Alloy, Fluent Bit, Fluentd or the OpenTelemetry path, with the tenant ID for its source. Keep the tenant assignment in the shipper configuration under version control so that a host cannot silently change tenants. If shippers authenticate to the proxy, bind each credential to one tenant. Check it by sending one test line from each source and confirming it appears under the expected tenant only.
Query each tenant and confirm isolation
From the Grafana data source or the command line, run the same simple query once per tenant through the proxy and confirm that only that tenant's test lines return. Then query with one tenant's credentials for a label value that exists only in another tenant and confirm zero results. Record the query, the expected result and the actual result for each tenant. The sequence is complete when every tenant passes both checks and the record is filed with the tenant register.
Why changing a tenant ID later needs a data migration
Changing a tenant ID after a cluster holds data is not a configuration edit. Loki stores compressed chunks and index entries under the tenant that wrote them, so a new ID does not automatically see the existing logs. On a cluster that already holds data, switching the tenant ID, including the single tenant used when auth_enabled is false and changed through no_auth_tenant, requires migrating the stored data. The same applies when a team renames a tenant, splits one tenant into two or merges environments. Treat the first production ingest as the point of no return for each ID you choose.
Before the first production write, settle the naming scheme, confirm that each ID sits within the length and character rules, and write down which team, environment or customer each ID represents. Keep that mapping in version-controlled documentation next to the reverse proxy configuration that injects the X-Scope-OrgID header, because the proxy and the Grafana data source definitions must agree on every ID. A mapping that lives only in one engineer's head becomes a risk the first time an incident or a reorganization changes who owns which logs.
Do not plan the migration from memory. Confirm the supported migration method with the Loki documentation for the exact version you run, since storage schema and index behavior have changed across releases. Ask your Loki operator or integrator to test the procedure on a copy of the data, measure how long it takes against your retention window and agree on how queries will be interrupted or dual-pointed during the cutover. Sibling guidance on retention and deletion covers what happens to logs under the old ID while the migration runs.
Security risks of weak tenant design
Tenant design is an access control decision as much as a data layout decision. The risks below share one root cause: the tenant ID decides which data a request can reach, so a wrong or unverified ID exposes data, hides accountability or applies the wrong limits. Check each one before the cluster holds production logs.
Client-supplied headers trusted directly
Loki identifies the tenant from the X-Scope-OrgID header, and it does not check who sent that header. If Loki is reachable without a proxy, any client can set any tenant ID and read another team's logs. Loki has no built-in authentication layer, so an authenticating reverse proxy must sit in front of it and overwrite the header with the tenant that the verified user is allowed to use. Confirm that Loki's listener is not exposed to users or workloads that bypass that proxy.
Loki authentication docsShared tenants hide who accessed what
When several teams or customers write into one tenant, query logs show a tenant ID but not which person or service ran a query. Audit questions such as who read production payment logs last month then have no reliable answer. Separate tenants per team or environment, and keep proxy-side audit logging that records the authenticated user alongside the tenant. Confirm that your proxy and Grafana logs capture identity for each query.
Tenant IDs leaking through dashboards
Grafana data source settings, shared dashboards and exported panels often embed the tenant ID as a plain value. Anyone who can view that dashboard learns the ID, and if the proxy trusts a client-chosen header, that is enough to attempt access. Keep tenant selection server-side where possible, avoid hard-coding IDs in shared dashboards, and review data source permissions in Grafana when tenants change. Tenant IDs are identifiers, not secrets, so treat them as protected only through the proxy.
Retention applied to the wrong tenant
Retention in Loki is disabled by default, and it can be set globally, per tenant or per stream selector. A retention rule written against the wrong tenant can delete data that a team needs for audit, or keep sensitive logs far longer than policy allows. Because retention is enforced by the compactor, a mistake may only show after data is gone. Test each per-tenant rule against a non-production tenant first and confirm which tenant each rule targets.
- Minimum stream rule
- 24 hours
Limits set on the wrong tenant
Per-tenant ingestion rates, stream counts and query limits protect the cluster, but they also decide which team's logs get dropped or rejected under load. A limit on a shared tenant can throttle a critical service because a noisy neighbor used the same ID. Map each limit to the tenant that owns the workload, and review the overrides after every tenant change. Confirm how your version applies overrides before you rely on them for isolation.
Assuming label-based access control is available
Restricting a tenant to streams that match label selectors is a separate capability from tenant isolation, and the Loki documentation describes it as generally available from Loki 4.0. Teams that assume label selectors protect data in an older version may expose more than they intend. Confirm the exact version and feature state before writing a policy, and where the feature is not available, rely on separate tenants or a commercial option such as Grafana Enterprise Logs.
Questions buyers ask before tenant design work
How many Loki tenants should we create?
Create one tenant for each group that needs its own data boundary, retention or limits, and avoid a tenant per team by default. The count follows from who must be isolated and who may query what, not from how many teams exist. Most organizations start by separating production from non-production, then add tenants only where a regulator, customer contract or data owner requires a distinct boundary. Every tenant needs its own limits and retention settings, so more tenants means more configuration to review. Loki identifies tenants with the X-Scope-OrgID header, so the mapping from people and services to tenant IDs must be written down before ingestion starts.
What does tenant design work cost and what drives it?
Tenant design work is priced from a written scope, and a quote follows from that scope. The main cost drivers are the number of tenants, how many systems must map credentials to tenant IDs, whether a reverse proxy with authentication must be designed, and how many teams or customers must review the model. Cost is mostly one-time design and review effort, while the ongoing tenant configuration and monitoring that follow are recurring work for your operations team or a retainer. Ask any provider to itemize design workshops, documentation, proxy requirements, and the handover to your team in the quote.
Can our team design Loki tenants ourselves?
Yes, a team that already runs Loki and understands its configuration can design tenants internally, provided it has the decisions and owners in place. The work is mostly decisions rather than code: what a tenant represents, how IDs are named, which systems send which tenant header, and who approves changes. The Loki multi-tenancy documentation covers the mechanics, and the risks sit in the gaps between the reverse proxy, the shipper and Grafana data source settings. Teams without an authenticating proxy or without a security reviewer often find the access model harder to settle than the Loki settings themselves.
How long does it take to settle the tenant model?
The duration depends on how many stakeholders must agree and how many existing sources must be mapped, so ask for a schedule in the written scope rather than relying on a general figure. Settling the model usually involves inventory of log sources, a decision session with data owners, a review of retention and access needs, and a written tenant register. Delays most often come from unresolved ownership of log data, pending compliance input, or customers whose contracts define their own boundaries. Starting with a small inventory of sources and owners shortens the decision cycle.
What do we need to provide before tenant design starts?
Provide an inventory of log sources, the teams or customers that own them, and any existing identity provider or proxy you plan to use. You should also share current Loki or log platform details, such as the deployment mode and whether auth_enabled is already set, along with retention requirements from security, legal or compliance owners. If customer or regulatory boundaries exist, supply the contract clauses or control requirements that define them. Confirm who can approve tenant changes, because that decision is what keeps the model stable after handover.
Can we change Loki tenant IDs later?
Changing a tenant ID later is possible only with a data migration, because stored data is associated with the ID it was written under. The Loki documentation states that when auth_enabled is false, the single tenant ID defaults to fake and can be changed through no_auth_tenant, but on a cluster that already holds data, changing it requires migrating that data. Treat tenant IDs as long-lived identifiers and choose them before the first production ingestion. The Loki multi-tenancy documentation also limits IDs to 150 bytes with a restricted character set and recommends a much shorter limit such as 20 bytes, so keep names short and stable.
What is the fake tenant and do we need it?
The fake tenant is the single tenant Loki uses when auth_enabled is false, and its ID defaults to fake. You need it only for a single-tenant setup without authentication, such as a test environment or a small single-team deployment. Production setups that separate teams or customers should set auth_enabled to true and send an X-Scope-OrgID header on each request. Switching modes on a cluster that already holds data brings the same migration concern as changing IDs, so decide the mode before ingestion begins.
How DeployOpen scopes Loki tenant design
DeployOpen works through Loki tenant design as a written scope: which boundaries become tenants, how IDs are named, and whether the cluster runs multi-tenant or single-tenant. The result is a documented design the platform, security and compliance teams can review before any logs are ingested.
How we scope
- Agree in writing whether a tenant represents a team, an environment or a customer, with the reasons for each choice.
- Set tenant ID naming rules and a length limit that your log pipeline, dashboards and access tooling can all follow.
- Confirm whether the cluster runs with auth_enabled set to true or as a single fake tenant before the design is fixed.
How we build
- Configure tenant IDs in agents and collectors, and check that every write sends the intended X-Scope-OrgID header.
- Test that a sample tenant cannot read another tenant's streams through Grafana, the API and the command line.
- Document the tenant map, the owner of each tenant and the process for adding a new tenant later.
How we hand over
- Deliver the tenant design document, configuration files and test results as written deliverables within the agreed scope.
- Walk platform and security teams through the tenant map and the reasons behind each boundary.
- Record the migration steps that would be needed if a tenant ID ever has to change after data exists.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades and continuous testing for the tenant setup are available as a retainer.
- Retainer reviews can cover new teams or customers joining the cluster and changes to the authenticating proxy.

