Multi-tenant OpenTelemetry pipelines with tenant headers: when a shared back end needs isolation
When several teams or customers send telemetry into one shared Loki or Mimir back end, tenant headers set in the Collector keep each tenant's data separate. The Collector attaches a tenant ID to every export request, and the back end files the data under that ID. OpenTelemetry itself is not a back end and does not store or isolate anything. The isolation comes from the back end's tenant model, so the design question is whether the Collector can reliably stamp the right tenant ID onto the right data, and whether the back end can trust that ID.
Loki and Mimir both rely on an ID header. Loki is multi-tenant when auth_enabled is true and reads the X-Scope-OrgID header on every request. Mimir requires a tenant ID header on every HTTP request. Neither product authenticates callers itself. Loki's documentation says you must run an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it, and Mimir's architecture documentation leaves authentication and authorization to an external proxy. A client that can reach the back end directly can therefore set any tenant ID it likes, which makes the proxy and the network path the real trust boundary.
Before you build, confirm three things with your own environment: which header and tenant names each back end expects in your version, whether the proxy overwrites or strips any tenant header a client sends, and whether each tenant's agents can reach only the gateway that adds the header. Test a spoofed header from an untrusted client and check that the data lands in the expected tenant. Read the OpenTelemetry Collector configuration docs alongside your back end's tenancy guide before you set the header in configuration.
Choosing a tenant isolation model for your back end
This table compares three ways to separate tenants: a Collector gateway per tenant, a shared gateway that routes by authenticated tenant, and tenant IDs set by the sending SDK. Read each row against your own isolation requirement, since the strength of separation depends on where the tenant ID is set and who can change it. The main takeaway is that only tenant IDs taken from authenticated identity at the gateway should be trusted by the back end.
| Model | Isolation strength and spoofing risk | Operational load |
|---|---|---|
| One Collector gateway per tenant | Strongest separation, since each tenant's data never shares a Collector process; spoofing is limited to the tenant's own endpoint | Highest: one gateway, config, certificate and scaling set per tenant to deploy and patch |
| Shared gateway routing by authenticated tenant | Strong when an authenticator extension resolves the tenant from identity and the routing connector sets the tenant header; senders cannot pick their own tenant | Moderate: one gateway fleet, but routing rules and auth mappings grow with each tenant |
| Tenant set by sending SDK via resource attributes | Weakest: any client that can reach the endpoint can claim another tenant unless the gateway overwrites the value | Lowest at the start, but every SDK must be configured correctly and the gateway still needs enforcement |
| Loki back end | Multi-tenancy applies only when auth_enabled is true; tenants are identified by the X-Scope-OrgID header on each request | Requires an authenticating reverse proxy in front, since Loki has no built-in authentication layer |
| Mimir back end | Each tenant's series are stored in their own Prometheus TSDB in object storage, which separates storage per tenant | Requires a tenant ID header on every request and an external proxy for authentication and authorization |
Setting up tenant headers and routing in the Collector
This sequence turns a shared Collector and back end into a multi-tenant path, where each tenant's telemetry is authenticated at the edge, labeled with a tenant header the client cannot forge, and stored separately. Each step ends with a check you can run before moving on.
Confirm the tenant model and identity source
Before editing any Collector configuration, decide what a tenant is in your environment: a team, a business unit or a customer. Write down which identity provider issues the credentials senders will use, and which claim or attribute maps to the tenant name. Your identity team or your IdP administrator should confirm that the claim is populated for every workload and user who sends telemetry. The output is a short mapping table, reviewed by the team that owns the back end, showing each sender group, its identity source and its tenant value. Do not start the build until every sender group has a mapping.
Enable authentication on the receivers
Configure an authenticator extension on the receiver side so the Collector rejects unauthenticated connections before any data is processed. The Collector configuration docs describe authenticator extensions that can validate OIDC tokens on incoming connections. Attach the extension to the OTLP receiver, bind the receiver to the interface your senders can reach, and keep the server-side TLS settings consistent with your transport design. Confirm the result by sending one request with no credentials and one with an invalid token. Both must be refused, and the Collector logs should show the rejection without exposing the token value.
Map the authenticated identity to a tenant value
Use the authenticated identity, not anything the sender writes in the payload, to derive the tenant name. In the Collector, this is done by reading the validated claim from the authentication context and copying it into a resource or context attribute that the rest of the pipeline uses. Keep the mapping narrow: one claim, one tenant value, with a documented fallback that drops the data rather than assigning a default tenant. Verify the mapping by sending a test span from a sender whose claim is known and checking that the derived tenant value in the Collector debug output matches the expected tenant.
Set the tenant header on exporters with headers_setter
Configure the headers_setter extension to take the tenant value from the request context and write it as the tenant header on outgoing exporter requests. For Loki, this is the X-Scope-OrgID header. For Mimir, the back end requires a tenant ID header on every HTTP request. Attach the extension to each exporter that writes to a tenant-aware back end and confirm the exact header name against the Collector and back end documentation for your versions. Overwrite any header a sender supplied rather than passing it through. The check is a request capture at the back end or proxy that shows the header set from the mapped value on every export.
Route by tenant to separate exporters where needed
If some tenants need their own storage, retention or destination, add a routing step that sends each tenant's data to a dedicated exporter or a dedicated pipeline. The routing connector can select a destination from a resource attribute set in the previous step. Keep a default route that drops or quarantines unmatched data, so a new or misconfigured tenant does not land in a shared store by accident. Check the routing with one test sender per tenant and confirm that each test record appears only in its own destination and not in any other tenant's store.
Enable multi-tenancy on Loki or Mimir
Turn on tenancy in the back end so it enforces the tenant header it receives. In Loki, set auth_enabled to true, which makes Loki identify tenants with the X-Scope-OrgID header on every request. In Mimir, the tenant ID header is required on every HTTP request. Both back ends leave authentication to an external component, so place an authenticating reverse proxy in front of them, such as one of the proxies named in the Loki authentication documentation, and make the proxy the only path from the Collector and from query users. Confirm the setting by sending a request with no tenant header, which should be refused, and then a request with one tenant header, which should return only that tenant's data.
Test forged tenant headers end to end
Run a deliberate spoofing test before any tenant goes live. Send a test span or log from a sender authenticated as tenant A, and include a forged tenant header naming tenant B in the request. Then query tenant B and tenant A in the back end. The expected result is that the forged value is overwritten by the value set from the authenticated identity, or the request is rejected, and that tenant B shows no record of the test. Repeat the test for a metric and a log record, and record the outcome for each signal. Keep this test in your pipeline checks so that configuration changes that remove the overwrite or the authentication are caught.
Review exposure and back-end access controls
Finish by confirming that nothing bypasses the controls built so far. Check that the back end ports are reachable only from the Collector and the authenticating proxy, that query paths also go through the proxy, and that operators with administrative access are documented separately from tenant users. Ask your security team to review the mapping table from the first step against the running configuration. The output is a signed-off checklist showing each sender group, its identity source, its tenant value, its destination and the date of the last forged-header test.
How tenant identity flows from SDK to back end
The tenant ID starts in the application's request context and is set as a header by the SDK's exporter, then travels over the network to the authenticated gateway Collector, which is the trust boundary. The gateway should overwrite any tenant value a client sent, route by tenant, and forward to the back end through a reverse proxy that enforces authentication. Check that the tenant header is set only at the gateway, not trusted from the client, and that each back end receives its own tenant header name.
Tenant identity moves from the SDK through the gateway to each back end.
Preventing spoofed tenant IDs and cross-tenant reads
Tenant separation only holds if the tenant ID is set by a trusted component, enforced at the back end and monitored over time. The cards below cover the Collector settings, the proxy layer in front of Loki and Mimir, query restrictions, assignment audits and the admin surfaces that could let someone bypass the rest.
Never trust client tenant headers
Any tenant header an SDK or application sends can be forged by a workload that reaches the pipeline. Treat the tenant value as data the Collector assigns, not data the sender declares. Confirm that the agents and gateways you run do not pass through a tenant header from the incoming request, and test by sending telemetry with a foreign tenant value and checking where it lands in the back end.
Collector security guidanceOverwrite tenant headers, do not append
When the Collector sets the tenant header, the setting must replace any existing value. If a value is appended, the back end may receive two tenant headers and act on the wrong one. Review the headers_setter configuration on every exporter that writes to Loki or Mimir, and confirm in a test that the final request carries exactly one tenant value that matches the pipeline's assignment.
Authenticating proxy in front of Loki and Mimir
Loki and Mimir identify tenants by header but do not authenticate callers on their own. Place an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of both, and make it the only route to their ports. The proxy should authenticate the client, then set or verify the tenant header itself so that clients cannot choose a tenant they were not granted.
Restrict query access per tenant
Write access and read access are separate decisions. Map each team or customer identity to the tenants it may query, and enforce that mapping at the proxy or identity layer before a request reaches the query path. Test with a user from one tenant trying to read another tenant's logs and series, and keep the results as evidence for your access review.
Loki multi-tenancy docsAudit tenant assignment regularly
Tenant mappings drift as teams change, services are renamed and customers are onboarded. Keep the source of truth for tenant IDs under version control or in your identity system, and review which pipelines, tokens and proxy rules map to each tenant. Check that retention rules and back-end limits still match each tenant's obligations, since Loki retention is disabled by default and set per tenant when enabled.
Keep admin and debug endpoints off shared networks
Collector diagnostic surfaces and back-end admin APIs can expose configuration, internal state or the ability to write into any tenant. Bind them to localhost or a management network, and keep them out of the path that tenant workloads use. Since Collector v0.110.0, server components bind to localhost by default, so confirm each receiver and extension setting explicitly rather than relying on the default alone.
Collector security guidanceRunning per-tenant retention, capacity and monitoring
Retention is the first control to set deliberately, because Loki retention is disabled by default. Until retention is enabled, logs are kept indefinitely, so a tenant that never receives a retention rule will accumulate data for as long as the store allows. Loki applies retention through the compactor and lets you set it globally, per tenant, or per stream selector, with each stream rule lasting at least 24 hours. Decide the retention period for each tenant from its contractual or internal requirement, write it into the tenant's limits, and confirm the exact configuration keys and compactor settings for your Loki version in the Loki retention documentation. Mimir needs the same discipline for its own data, so record the retention and limit values per tenant in the same place as the tenant register.
Mimir enforces per-tenant limits, so capacity planning starts with each tenant's expected active series, ingestion rate and query load rather than with the cluster as a whole. Set limits for each tenant so one team's cardinality spike cannot consume the shared ingest path. Mimir's README reports internal testing up to 1 billion active time series, but that figure describes a tested ceiling, not a sizing guarantee for your workload. Ask the vendor and your own load tests to confirm how the chosen deployment mode, ingest storage architecture and object store behave for your tenant mix. Plan capacity for the largest tenant first, then for the sum of the rest, and treat the Helm chart values as a starting point that your load tests must validate.
Dropped data is the failure that tenants notice last, so monitor it per tenant. When a limit rejects samples or log lines, the Collector and the back end may log the rejection without the tenant owner ever seeing a gap in a dashboard. Build alerts on rejected or dropped counts keyed by tenant, and route them to the tenant owner as well as the platform team. Check the same signals after every limit or retention change, and confirm which metrics each component exposes for your version in the vendor documentation. Deployment modes and sizing for both Loki and Mimir change between releases, so confirm them against the current vendor documentation before you commit to a design.
Limits to confirm before you rely on tenant separation
Tenant headers only separate data if every hop in the path carries and enforces them correctly. The cards below cover the components, versions and isolation claims to verify in your own environment before a shared back end holds data from more than one team or customer.
Authenticator and headers_setter support
Confirm that the authenticator extension and headers_setter behave as expected for your identity provider and the Collector version you run. The tenant value must come from a verified identity, not from a header the sender controls. Test with a token from each provider you plan to accept, and check what happens when the token is missing, expired or belongs to another tenant.
Collector configuration docsBack-end authentication configuration
Loki and Mimir both rely on the tenant header and leave authentication to a reverse proxy in front of them. Confirm which proxy enforces who may send or read each tenant, that direct access to the back end's ports is blocked, and that the proxy rewrites or strips any tenant header a client supplies. Record the exact configuration you tested.
- Tenant header
- X-Scope-OrgID
Tenant visibility in query results
Check whether query results, labels and dashboards show which tenant a record belongs to, and whether users can see tenant names or identifiers they should not know. Confirm that a user authorized for one tenant cannot run a query that returns series, streams or label values from another. Include Grafana data source permissions in this test, since they sit outside the Collector.
Collector distribution support
Confirm which Collector distribution, version and components you run, and whether the components used for tenant routing and authentication are stable at that version. Core components have mixed stability levels, so read each component's README. Track the exact version so you can apply patches and verify the release artifacts before deployment.
OpenTelemetry statusIsolation against your requirements
Decide whether logical separation by tenant ID meets your internal policy or regulatory obligations for data residency, access review and audit logging. Separation in a shared store is a configuration outcome, so ask an independent assessor to review your design. Confirm where each tenant's data is stored, who administers the back end, and how a tenant's data is deleted on request.
Questions teams ask about multi-tenant OpenTelemetry
What drives the cost and effort of a multi-tenant OpenTelemetry pipeline?
The biggest drivers are the number of tenants, how many telemetry sources each tenant sends, and how strictly tenants must be kept apart. Each tenant adds routing rules, header handling and access checks, and every back end you choose adds its own storage layout and query path. Costs fall into two groups: one-time work (design, Collector configuration, identity integration, testing) and recurring work (upgrades, onboarding, retention reviews, and infrastructure). For Loki, retention is disabled by default, so logs persist until you configure it, which changes storage cost for every tenant. For Mimir, each tenant's series are stored in their own TSDB in object storage, so tenant count and series volume shape sizing. Ask any partner for a quote that lists these items separately, with the back-end sizing assumptions written out.
How long does a typical multi-tenant rollout take, and what sets that time?
Duration depends mainly on how many back ends are in scope, how many teams or customers need separate tenants, and whether your identity provider and reverse proxy already exist. A single back end with a few tenants is much shorter than a shared platform serving many business units with different retention and access rules. Deployment mode also matters: Loki's monolithic mode suits smaller volumes, while simple scalable mode is documented as deprecated and slated for removal in Loki 4.0, which can add a migration step if you start there. Mimir's ingest architecture choice, classic or Kafka-based from Mimir 3.0, adds planning time. Confirm the exact timeline in a written scope, since no general duration applies to every environment.
What does the work need from our identity and platform teams?
Multi-tenant isolation depends on identity more than on the Collector itself. Both Loki and Mimir identify tenants with a header on every request, and both leave authentication to an external layer. Loki has no built-in authentication and requires an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium, while Mimir also relies on an external reverse proxy. Your identity team needs to supply the identity provider, group-to-tenant mappings and token claims that the proxy or Collector authenticator will check. Your platform team needs to provide Kubernetes or VM capacity, object storage buckets with access policies, DNS and TLS certificates, and secret storage for credentials. Agree these dependencies early, because most delays come from waiting on them.
Can our internal team build and run this without a partner?
Yes, an experienced internal team can build it, provided it has skills in OpenTelemetry Collector configuration, the chosen back end, object storage, reverse proxy authentication and Kubernetes or VM operations. The harder parts are usually the ones that are easy to skip: deciding how tenant IDs are derived, proving that a client cannot set another tenant's header, and testing that queries stay inside one tenant. A partner adds value when the team lacks capacity for those tests or for the migration. Ask for a written split of responsibilities, so you know who owns the Collector configuration, the proxy rules, the back-end settings and the onboarding runbook after handover.
How does tenant onboarding and offboarding work after go-live?
Onboarding is usually a repeatable change: create the identity group or client, add the tenant to the proxy and Collector routing, set retention for that tenant, and confirm that data arrives under the right tenant ID. Retention is a key decision. In Loki, retention is applied by the compactor, can be set globally, per tenant or per stream selector, and each stream rule must be at least 24 hours. In Mimir, a tenant's data sits in its own TSDB, so removing a tenant means deleting that storage as well as the routing. Offboarding should include revoking credentials, stopping ingest, exporting or deleting data according to policy, and recording the action. Ask for these steps as a documented runbook with tests, not as a one-off task.
What should we verify before trusting tenant separation?
Test that a client holding one tenant's credentials cannot read or write another tenant's data, including attempts to send a spoofed tenant header. Check that the authenticating proxy or Collector authenticator overwrites or rejects tenant headers supplied by clients, and that the Collector sets the tenant ID from trusted context. Run queries from each tenant and confirm results contain only that tenant's series or logs. Keep these checks in the pipeline so they repeat after upgrades. Ask any partner to deliver the test cases and results in writing, since an internal review or external test report is what your auditors will ask to see.
Do we need a Kafka cluster or other shared infrastructure for this?
Not for every design. Mimir's classic architecture uses stateful ingesters with local write-ahead logs, while its preferred ingest storage architecture from Mimir 3.0 uses Kafka as a central pipeline to decouple reads from writes. Loki's storage is built on object storage, with Amazon S3, Google Cloud Storage and Azure Blob Storage as its recommended production stores. Choosing the Kafka path adds an operational dependency that your platform team must run, monitor and back up. Confirm your operating capacity and the expected volume before choosing an architecture, and ask for the reasoning to be written into the design record.
How DeployOpen scopes and delivers tenant isolation
DeployOpen is a Chainscore Labs company that plans, implements and supports self-hosted open-source platforms inside your own cloud accounts, data centers or air-gapped networks. For tenant isolation, that means the header-setting processors, Collector routing, the Loki or Mimir tenant configuration and the authenticating proxy in front of each back end are built and run in your environment, so your security and compliance teams review the actual systems that handle tenant data. Most engagements are fixed-scope: the tenants in scope, the signals covered, the back ends involved, the authentication model and the deliverables are agreed in writing before work starts, and the written scope is what a quote is based on.
The written scope for this topic should name the decisions that shape the work: how each tenant is identified (for example, from authenticated context in the Collector pipeline or from the application), which back ends receive tenant-scoped data, how the reverse proxy maps identities to tenant IDs, and who owns the tenant registry. It should also state what is out of scope, such as application code changes in teams' services. Ask for the deliverables in writing, including configuration as code, a tenant onboarding procedure and the test cases used to prove isolation. Ask for the same detail in any quote you receive from another provider.
Security testing can verify tenant isolation as a separate engagement. DeployOpen runs application, API and infrastructure security testing, so a tester can attempt to send spoofed X-Scope-OrgID or tenant headers, query another tenant's logs or series, and check that the Collector strips or overwrites client-supplied values. Findings come with fixes and a retest, and the results can be used as evidence in your own review. Ongoing support is available as a retainer, which covers upgrades to Collector and back-end releases, onboarding of new tenants, periodic re-testing after configuration changes and incident support when a routing rule needs to change.

