Sending OpenTelemetry logs to Loki's native OTLP endpoint without label sprawl
Loki ingests OpenTelemetry logs over HTTP using OTLP, and the design choice that matters most is which resource attributes become index labels. Every label value creates part of a stream identity, so an attribute with unbounded values, such as a request or pod identifier, can multiply streams and degrade query speed and storage cost. Decide the label set before the first exporter is pointed at Loki, because changing it later affects how existing data is queried. OpenTelemetry is a vendor-neutral framework for generating, exporting and collecting telemetry, not a storage backend, so Loki (or another backend) is still chosen and operated separately. The OpenTelemetry Collector is Apache-2.0 licensed and can run as an agent beside services or as a gateway that receives data from many sources.
Loki's otlp_config block under limits_config controls the mapping. By default, scope and log attributes are stored as structured metadata rather than as labels, which keeps the index small while still making those fields filterable at query time. Resource attributes are the usual candidates for labels, but only low-cardinality ones such as service name, namespace or environment belong there. Confirm the exact keys and defaults for your Loki version in the Loki OpenTelemetry documentation before writing configuration, since the attribute lists are what you will tune. Test with a representative sample of real logs and count the resulting streams before rolling out to production.
Plan three checks before go-live. First, confirm that every label you keep has a bounded set of values and that high-cardinality fields are stored as structured metadata. Second, confirm which Collector components in your pipeline add or rename attributes, because a processor can silently create new labels. Third, check that the Collector release you deploy matches the one your team has tested, since component stability varies and is documented per component in the OpenTelemetry status pages. Write these checks into the rollout runbook so a later change to otlp_config or a Collector processor is reviewed against the label budget.
What you need before the first OTLP log arrives
Five things have to be in place before a Collector or SDK can send logs to Loki's OTLP endpoint: a running Loki with the right tenant settings, a Collector build you can trust, a network path between them, an authenticating proxy in front of Loki, and SDKs with usable log support. Work through the cards in order, since the tenant and network choices shape the exporter configuration you write later.
A running Loki with a chosen mode
Confirm which deployment mode you run before writing any exporter config. Loki documents monolithic mode for smaller volumes, simple scalable mode with separate read, write and backend targets, and microservices for very large clusters. Simple scalable mode is being deprecated and will be removed with Loki 4.0, so a new deployment should be checked against that plan. Confirm the write path accepts OTLP on the endpoint your mode exposes.
Deployment modes docsCollector build and version
Deploy the contrib distribution of the OpenTelemetry Collector, since the OTLP-to-Loki exporter path depends on components that ship there. The Collector v0.163.0 release was published on October 16, 2026. Pin one version in your manifests, record it in change control, and test upgrades in a non-production pipeline before rollout.
Verified release artifacts
Collector releases ship signed artifacts, SHA256 checksums and SBOM files. Verify the checksum and signature of the binary or image you deploy, and keep the SBOM with your asset inventory so your vulnerability team can match component versions against advisories. Ask your platform team which signing check your admission controller or image policy enforces.
Collector release notesNetwork path from Collector to Loki
Confirm that the Collector's network segment can reach Loki's distributor or gateway address on the OTLP port over TLS, and that any firewall, service mesh or egress policy allows the flow. Check DNS resolution from inside the Collector pod or host, not from your laptop. If Loki sits behind a load balancer, confirm it does not strip the X-Scope-OrgID header.
Tenant settings and the org ID header
Decide whether Loki runs with auth_enabled set to true. When it is, Loki identifies each tenant from the X-Scope-OrgID header on every request, so the Collector must send that header with a tenant value you have planned. Without it, requests are rejected or land in the wrong tenant. Record the tenant naming scheme before the first export, because changing it later splits historical data.
Multi-tenancy docsAuthenticating reverse proxy in front of Loki
Loki has no built-in authentication layer, so you must place an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. The proxy must enforce identity on OTLP writes as well as reads. Collector authenticator extensions can add credentials to exporter requests, so confirm with your security team which credential the Collector presents and how it is rotated.
Authentication docsLog SDK maturity per language
Trace APIs and SDKs are stable in most languages, but log SDK maturity varies and several languages are still in development. For each instrumented application, check the log status for its language on the OpenTelemetry status page before you commit to direct SDK export. Where a language is not ready, plan to collect the application's logs through the Collector or another shipper instead.
OpenTelemetry status pageHow to configure the OTLP log exporter step by step
This sequence takes a team from a Loki endpoint that accepts OTLP to a verified pipeline where every service sends logs with the right tenant, labels and structured metadata. Each step ends with a check so problems surface before the rollout reaches the remaining services.
Confirm Loki accepts OTLP on its HTTP endpoint
Before touching the Collector, confirm that your Loki deployment exposes the OTLP log ingestion path over HTTP and that the reverse proxy in front of it passes the request through with its headers intact. Check the current OTLP ingestion details in the Loki OpenTelemetry documentation, since the path and the expected request format are defined there, not by this page. Ask your Loki administrator whether authentication is enabled, because that decides whether the tenant header is required. The check is a test request from a workstation or a Collector host that returns a success response from the ingestion endpoint rather than an authentication or routing error.
Decide tenant handling and authentication for the exporter
If Loki runs with auth_enabled set to true, every request must carry the X-Scope-OrgID header, and the value identifies the tenant that will own the logs. Agree on the tenant ID with the team that operates Loki and record it in the change plan. Because Loki has no built-in authentication layer, confirm which authenticating reverse proxy protects the endpoint and what credentials the Collector will present to it. The Collector configuration docs describe how exporter-side extensions can add credentials to outgoing requests, so decide whether a static header or an OAuth2 client flow fits your environment. The output of this step is a written tenant ID and credential method that the next step will reference.
Configure the Collector with an OTLP exporter and tenant header
On the Collector host or gateway, add an OTLP exporter that points at the Loki endpoint confirmed in step one and sets the tenant header agreed in step two. Build the pipeline with a logs pipeline that uses this exporter, and keep the configuration in version control so changes are reviewed. Use the exact exporter keys and header syntax shown in the Collector configuration documentation and the Loki OpenTelemetry guide for your Collector distribution, and validate the file with the Collector's configuration check before starting it. The check is that the Collector starts cleanly, reports the logs pipeline as active, and logs no export errors when it sends its own internal test data.
Review otlp_config in limits_config before sending data
Loki's otlp_config in limits_config decides whether OTLP resource attributes become index labels or structured metadata. By default, scope and log attributes are stored as structured metadata, so review the defaults against your label strategy before the first real service sends data. Changing these settings after data has arrived affects only new ingestion, so record the decision and the reason for it. Ask the Loki operator to apply the change in the Loki configuration, since it lives in the server settings, not the Collector. The check is that the Loki configuration reflects the agreed mapping, confirmed by the operator and by the test entry in the next step.
Send a test log from one service
Choose one non-critical service and point its log export at the Collector, so the Collector forwards the entries to Loki. Emit a few log lines with known content, including a recognizable marker string, so they are easy to find. Open Grafana, select the Loki data source for the tenant, and query for the service by its resource label or the marker text. Inspect one returned entry to confirm which fields are labels in the stream selector and which appear as structured metadata. The check is a matching entry with the expected labels and metadata. If the labels are wrong, return to step four before any other service is connected.
Confirm labels and structured metadata on a sample entry
Compare the sample entry against the mapping you recorded. Confirm that the labels in the stream selector are low in number and stable, such as service name or environment, and that high-variation attributes such as request identifiers, trace IDs or user IDs sit in structured metadata rather than in labels. Confirm that the tenant in the query matches the tenant ID from step two. Record the stream count for the test service so you can compare it after rollout. The check is a written note of the labels, metadata fields and tenant that the test produced, signed off by the team that owns the Loki cluster.
Roll out to the remaining services in stages
Add the remaining services to the Collector pipeline in small groups, using the same exporter, tenant and mapping that passed the test. After each group, query Grafana for the new streams, confirm the labels match the agreed mapping, and watch the Collector and Loki for export or ingestion errors. Keep the previous configuration available so a group can be rolled back quickly if a service produces unexpected labels. The output is a single Collector configuration covering all in-scope services, with each group verified in Grafana, and a list of any services that need an attribute change at the source before they join.
How OTLP logs move from applications to Loki and Grafana
The path starts in application SDKs and agent Collectors, which send OTLP logs to a gateway Collector. The gateway forwards them through an authenticating reverse proxy, because Loki has no built-in authentication layer, into Loki, where its otlp_config decides which resource attributes become index labels and which land in structured metadata. Loki writes chunks and its index to object storage, and Grafana queries Loki through the proxy. Check at the trust boundary that the proxy sets the tenant header and that the Collector sends credentials.
OTLP log flow from applications through a gateway and proxy into Loki and Grafana.
Which OpenTelemetry attributes become labels and which become structured metadata
This table compares resource attributes, scope attributes and log record attributes under Loki's default OTLP handling, with the decision you must make for each group and the cardinality risk it carries. Read it as a starting point: the default resource attribute list is set in Loki's documentation, so confirm it against your Loki version before you finalize label choices. The main takeaway is that by default scope and log attributes go to structured metadata, so only a short list of stable resource attributes should be promoted to labels.
| Attribute group | Default handling | Decision for you | Cardinality risk |
|---|---|---|---|
| Resource attributes on the default list | Stored as index labels | Keep as label if values are few and stable, such as service name or namespace | Low for stable identifiers, high if a value changes per instance or request |
| Resource attributes not on the default list | Stored as structured metadata | Keep as metadata for search, or move to a label only if you query by it constantly | Moderate, because promoting them later can split existing streams |
| Scope attributes | Stored as structured metadata | Keep as metadata unless a stable scope name is needed for stream selection | Low to moderate, depending on how many libraries emit distinct scope values |
| Log record attributes | Stored as structured metadata | Keep as metadata for filtering in LogQL; drop fields you never query | High if they carry IDs, user names or request paths |
| Attributes you move into labels via otlp_config | Changed from metadata to index labels | Change only after checking the label count each tenant will create | High, since every unique value adds a new stream |
| Attributes you drop before export | Not sent to Loki | Drop secrets, personal data and unused debug fields at the Collector | None in Loki, but removing data early reduces storage and risk |
Changing the otlp_config defaults without breaking queries
Move an OpenTelemetry attribute from structured metadata to a label only when you filter on it constantly and it has a small, stable set of values, such as a deployment environment or service name. Labels define streams, so every new distinct combination creates more streams for Loki to index and track. Structured metadata stays out of the index, which keeps stream count down but makes filtering on those fields a line-level operation that costs more at query time. Moving a high-cardinality attribute such as a request ID or user ID into a label is the common mistake, and it is easiest to catch before data flows, by listing the candidate attributes and their expected value counts with the team that owns the services. Confirm the current otlp_config behavior and the exact key names against the Loki documentation for your version before you edit the configuration, because the defaults and option names are the first thing to verify.
Treat every change to otlp_config as applying to new data only. Logs already written keep the labels and metadata they were ingested with, so a dashboard built on the new label will show results only from the change point forward, while queries on the old field keep working for older data. Plan a window where both forms are queried, and check that alert rules and saved dashboard panels reference the field that will hold the data during that window. Changing a label also changes the stream identity, so a rule that counts streams or matches a fixed label set can silently return less data after the change. Before rolling out, run the affected LogQL queries against a test tenant that receives the new configuration, and record the stream counts before and after.
Label changes also need updates outside Loki. Dashboards, alerting rules, recording rules and any Grafana Explore bookmarks that refer to the old attribute name will need editing, and the team that owns each one should sign off before the change is deployed. For the wider rules on choosing labels, managing cardinality and when stream sharding helps, see the labels and cardinality guidance in this set of pages. Record each otlp_config change in your change log with the date, the attributes moved, the expected stream impact and the owners of the affected queries, so that a later investigation of a missing series can be traced back to a specific configuration change.
Securing the OTLP path into Loki
Loki's OTLP endpoint has no authentication of its own, so the path from Collector to Loki needs an authenticating layer, a tenant header that is set deliberately, and encrypted transport. The cards below cover each control and the checks to run before logs from production systems flow into the endpoint.
Authenticating reverse proxy in front of Loki
Loki has no built-in authentication layer, so the OTLP endpoint must sit behind an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium. Make sure the proxy is the only network path to Loki's port, so no client can bypass it and write logs directly. Test that an unauthenticated request to the OTLP path is rejected before any Collector is pointed at it.
Loki authentication docsTenant isolation through X-Scope-OrgID
When auth_enabled is true, Loki identifies each tenant by the X-Scope-OrgID header on every request. Decide which component sets this header, usually the proxy or the Collector exporter headers, and make sure clients cannot override it with a value for another team. Confirm that queries from one tenant never return another tenant's streams during acceptance testing.
Loki multi-tenancy docsCollector authenticator extensions for incoming requests
Collector authenticator extensions can check credentials on incoming OTLP connections, for example with OIDC, so unknown senders are refused at the Collector before data is forwarded. This is useful in gateway deployments where many applications send to one Collector. Confirm which receivers and authenticator versions your Collector distribution supports, since component stability varies.
Collector configuration docsOutgoing credentials with oauth2client
The oauth2client extension adds credentials to requests the Collector sends to Loki, so the exporter does not store a static token in its configuration file. Ask the proxy team which token issuer and scopes it expects, and confirm how the token is rotated. Keep the client secret in a secret store or environment variable rather than in a file checked into version control.
TLS between Collector and Loki
Encrypt the hop from the Collector to the proxy and from the proxy to Loki, so log lines and tenant headers are not exposed on the network. Configure the Collector to verify the server certificate against your internal certificate authority, and do not disable verification to get a test working. Check certificate expiry dates and renewal steps as part of the operations runbook.
Keeping sensitive values out of log attributes
OTLP resource and log attributes are stored with the log, so a token, password, card number or patient identifier placed in an attribute becomes searchable by everyone with query access to that tenant. Remove or hash sensitive fields with Collector processors before export, and review application log statements in a sample. Use the Collector configuration best practices page as the checklist for securing the pipeline itself.
Collector best practicesCommon OTLP log failures and how to fix them
This table pairs common OTLP log write failures with their likely cause and the fix to try first. Read each row against the symptom you see in the Collector or SDK output, then confirm the behavior in your own Loki logs and ingestion limits. The main takeaway is that most failures trace to the proxy, the tenant header, or label mapping choices, and each can be checked before changing anything.
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 or 403 from the proxy | Loki has no built-in authentication, so the reverse proxy in front of it rejects the exporter's credentials or token | Confirm the exporter sends the credentials the proxy expects, such as via the Collector's authenticator extensions, and test the route with a single request before retrying the pipeline |
| Writes rejected for missing tenant | With auth_enabled set to true, Loki identifies tenants by the X-Scope-OrgID header, and the exporter did not send it | Add the X-Scope-OrgID header to the OTLP exporter's headers configuration, or ensure the proxy injects it for each tenant route |
| Writes rejected by ingestion limits | The write exceeds per-tenant ingestion or stream limits, which the Loki logs and limits configuration controls | Check Loki's logs for the rejection reason, review the ingestion limits for the tenant, and reduce volume or adjust limits deliberately |
| High-cardinality label explosion after mapping change | A change to otlp_config moved attributes that vary per request, such as IDs, into index labels, creating many small streams | Revert the attribute to structured metadata in otlp_config, then review which resource attributes are promoted to labels before reapplying the change |
| Logs arrive without expected labels | Attributes were not promoted by otlp_config, so they are stored as structured metadata rather than as index labels that queries select on | Check the otlp_config settings against the attribute names in your data, update the mapping, and query by the structured metadata field to confirm the value arrived |
| Log SDK exporter unstable for a language | OpenTelemetry log SDK maturity varies by language, and some language SDKs are still in development | Check the OpenTelemetry status page for your language before relying on its log exporter, and consider routing logs through a Collector instead |
| Collector component reports unstable behavior | Core Collector components have mixed stability levels, so the receiver or exporter used may change between releases | Read the component's README for its stability level, pin the Collector distribution version, and test upgrades in a non-production pipeline first |
Questions teams ask before sending OpenTelemetry logs to Loki
Can our team set up OpenTelemetry log export to Loki without outside help?
Yes, a team with Loki running, a Collector or SDK already in use, and someone who can edit Collector configuration can point an OTLP exporter at Loki's native endpoint. The harder part is the surrounding work: deciding which resource attributes become labels, placing an authenticating reverse proxy in front of Loki, and agreeing tenant IDs with service owners. Loki has no built-in authentication layer, so the proxy and the X-Scope-OrgID header handling must be in place before any service sends data. Teams without an in-house owner for the proxy, label design and tenant model often choose a fixed-scope engagement, where scope and deliverables are agreed in writing before work starts.
What drives the effort of an OpenTelemetry to Loki rollout?
Effort grows with four factors: the number of services and hosts sending logs, the Collector topology, the label design, and the authentication model. A single agent exporting directly to Loki is simpler than a tiered setup where agents forward to gateway Collectors that handle batching, retries and authentication. Label design takes the most judgment, because each resource attribute promoted to an index label creates stream dimensions that must stay low in cardinality. Auth adds work at both ends: an authenticating proxy in front of Loki, and any credentials the Collector must attach to exporter requests. Ask any partner to break the quote down by these four drivers.
Do we need Grafana Alloy instead of the OpenTelemetry Collector for Loki?
Not necessarily. Grafana Alloy is Grafana's supported log shipper for Loki and is a vendor-neutral distribution of the OpenTelemetry Collector, so it is a valid choice when you want Grafana-maintained components for files, journald, Kubernetes and similar sources. Loki also ingests OpenTelemetry logs over HTTP, so a standard Collector works if your applications already emit OTLP. Choose Alloy when you need its source components, and the plain Collector when your estate is already built on OTLP and the Collector's contrib distribution covers your receivers. Many environments run both, with each tool handling the sources it does best.
How long does a pilot for OTLP log export take?
The honest answer depends on steps rather than a fixed duration, because the timeline follows your environment. A pilot usually moves through the same sequence: confirm Loki deployment mode and storage, put an authenticating proxy in front of it, choose the tenant plan, define the label set for one or two services, configure the Collector or SDK exporter, then check that streams and structured metadata look right in Grafana. Each step can wait on an approval, a network change or a service owner's availability. Ask any partner for the pilot plan as a list of steps with owners and dependencies, and treat any single duration without that breakdown as incomplete.
What must our organization provide before the work starts?
Five inputs make the work possible. You need Loki access, including the deployment mode, the object store and a way to reach the write path from the Collector hosts. You need the authenticating reverse proxy, such as nginx, HAProxy, OAuth2 Proxy or Pomerium, or a decision on which one to use. You need a tenant plan that maps teams, customers or environments to X-Scope-OrgID values. You need named service owners who can confirm which services send logs and which fields are safe to keep. Finally, you need someone who can review and deploy Collector configuration changes. Missing any of these usually moves the schedule more than the technical configuration does.
What changes after we update otlp_config in Loki?
Changing otlp_config in limits_config alters how incoming OTLP attributes are stored from that point on. By default, scope and log attributes are stored as structured metadata, and resource attributes are handled according to the configured mapping. Moving an attribute into index labels changes stream definitions, so new data lands in new streams while existing data keeps its earlier layout. Queries and dashboards written against old label names can break, and high-cardinality values promoted to labels can raise index size and query cost. Test the change on a single tenant, confirm the affected dashboards and alerts, and record the new mapping in your configuration repository before rolling it out.
Who is responsible for security of logs sent over OTLP?
Responsibility is shared, and each layer needs an owner. The Collector can authenticate incoming connections on its receivers, for example with OIDC, and can attach credentials to outgoing exporter requests, for example with the oauth2client extension. Loki itself relies on the reverse proxy for authentication, so the proxy must enforce identity and must not pass unauthenticated writes through. Tenant IDs must be set by the trusted path, not by the sending application, or one service could write into another team's tenant. Ask your partner to list each control, the component that enforces it and how it will be tested before any production traffic is sent.
Does sending OTLP logs to Loki affect licensing or support obligations?
Loki is licensed under AGPLv3, which Grafana Labs adopted on April 20, 2021, replacing Apache License 2.0 for Loki and its other core projects. The OpenTelemetry Collector repository is licensed under Apache-2.0. Teams that modify Loki or offer it to users over a network should have their legal team review AGPLv3 obligations before rollout. Support is a separate question: self-hosted open-source Loki has no vendor support contract by default, and Grafana Enterprise Logs adds token authorization, label-based access control and cross-tenant queries. Confirm with Grafana Labs and your legal team which obligations and support options apply to your deployment.
How DeployOpen scopes an OTLP logging integration
The scope is agreed in writing before any Collector or Loki configuration changes, and it fixes the decisions that are expensive to reverse later: which services send logs over OTLP, where the Collector runs, how resource attributes are mapped to labels and structured metadata, how senders and the Loki endpoint authenticate, and how the result is tested. A written scope for this topic should name each application or log source, the OpenTelemetry SDK or Collector version it uses, and whether logs reach Loki directly from SDKs or through an agent or gateway Collector. Topology drives most of the later effort, so the scope should say which Collector roles exist (agent next to workloads, gateway receiving from many sources, or both) and who operates each one.
The label and metadata design is the part most worth settling in the scope document. The scope should list the resource attributes that will be promoted to index labels, the attributes that will stay in structured metadata, and any changes to the defaults made through otlp_config in limits_config. It should also state the tenant model, including whether auth_enabled is on and which X-Scope-OrgID value each sender uses. Authentication belongs in the same section: the scope should record how incoming OTLP connections are authenticated, for example through an authenticating reverse proxy in front of Loki, and how Collector exporters attach credentials, since Loki has no built-in authentication layer. Confirm the Collector version and its component stability in the official documentation before committing to a specific component set.
The test plan closes the scope. It should define how each source is checked for label cardinality, whether expected fields are searchable in Grafana, how rejected or dropped records appear in Collector and Loki metrics, and what happens when a tenant exceeds its limits. The scope should also say who receives the written findings and what counts as acceptance. Ask for the list of in-scope services, the target topology diagram, the label and metadata table, and the test cases before accepting a quote, because those documents are what the quote is based on.
How DeployOpen works on this
DeployOpen plans and builds OpenTelemetry log pipelines into self-hosted Loki inside infrastructure you control. The work starts with a written scope that fixes which resource attributes become labels, what lands in structured metadata, and how the Collector and Loki are tested and handed over.
How we scope
- Inventory which services and Collectors will send OTLP logs and which backends they already use
- Agree the label set and structured metadata plan for your streams before any configuration is written
- Confirm your Loki version, deployment mode, authentication proxy and tenant model in the written scope
How we build
- Configure the OpenTelemetry Collector exporter and any otlp_config changes in Loki's limits settings
- Test with representative log volume to check label cardinality and how attributes appear in Grafana
- Add authenticating proxy and credential handling for exporters, following Collector configuration best practices
How we hand over
- Deliver tested Collector and Loki configuration files with notes on each label and metadata decision
- Document the verification queries your team can run to confirm logs arrive with the expected attributes
- Walk through operating steps, version pinning and how to change defaults safely later
How we support
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts
- Ongoing support, upgrades and continuous testing are available as a retainer after handover
- Quotes follow from the written scope, so ask for the scope items that drive effort in your environment

