Why teams change Loki's default OpenTelemetry labels
A team that ships OTLP logs to Loki often sees its stream count and storage costs climb after a rollout, and the cause can be a default that most teams never inspected. Loki promotes certain OpenTelemetry resource attributes to index labels by default, and Grafana no longer recommends indexing k8s.pod.name and service.instance.id because their values are high cardinality: every new pod or instance creates a new stream. Grafana has not deprecated these labels, because removing them would break existing users, so they stay in place until you change them.
Changing the defaults is worth the effort when your pods are short-lived, autoscaling or redeployed often, because each replacement creates fresh streams that Loki must index and store separately. Check the stream count per tenant and compare it with the number of distinct values for these attributes before you decide. Confirm with your own metrics whether the cost is coming from these labels or from elsewhere, such as too many other labels or very busy streams. The change does not rewrite data already ingested: streams written under the old labels stay as they are and age out under your retention settings, so expect a period when old and new streams overlap in queries.
The change also does not alter what your queries can find. The attribute values still exist on each log line as structured metadata or in the log content, so you can filter on them, but queries that select by label will need to use a different pattern, and dashboards or alerts built on k8s_pod_name style selectors must be reviewed before rollout. Ask your platform team to list every saved query, alert rule and Grafana dashboard that depends on these labels, and test them against a non-production tenant first. Read the official modify default OpenTelemetry labels guide and confirm the setting names and the Loki version your cluster runs before you plan the change.
How OTLP attributes become labels, metadata or log content
The diagram starts at an application or Collector that sends OTLP logs to Loki's OTLP endpoint. Each resource attribute then faces one decision: keep it as an index label, store it as structured metadata, or drop it. The tenant boundary sits around the whole path, and the per-tenant settings that control the mapping are the point where you change defaults. Check that high-cardinality attributes such as k8s.pod.name and service.instance.id land in structured metadata for each tenant before you rely on the change.
Each OTLP resource attribute is routed to a label, metadata or nowhere per tenant.
Which attributes to keep as labels and which to move
This table compares the OpenTelemetry resource attributes Loki may promote to index labels, grouped by cardinality. Read each row against your own pipeline: bounded attributes usually belong in labels, while attributes that change per pod or per instance usually fit better as structured metadata. The main takeaway is that label choices set stream count, and stream count drives both cost and query speed.
| Attribute | Index label fits when | Structured metadata fits when | Query trade-off |
|---|---|---|---|
| k8s.namespace.name | Namespaces are few and stable, and most queries start by selecting one namespace | Rarely needed, since namespace scoping is usually the first filter | Label selectors are fastest, but every new namespace adds streams |
| cluster or k8s.cluster.name | You run a small, fixed set of clusters that you query side by side | Only if you never filter by cluster at ingest time | Keeps tenant-wide queries simple, with a small stream count increase per cluster |
| deployment.environment (environment) | Values are a short fixed list such as prod, staging and dev | Rarely useful; it is a bounded value | Good selector for access control and retention rules, with low added cost |
| service.name | Each service has one stable name, and most queries select by service | Not needed for stream identity if your services are few | Fast service selection; confirm how Grafana uses this value before changing it |
| k8s.pod.name | Rarely a good fit, because pods are replaced on every rollout | Usually the better home, so you can filter by pod while keeping stream count low | Metadata filters scan content rather than selecting streams, so queries are slower on large ranges |
| service.instance.id | Rarely a good fit, because each process or container gets a new value | Usually the better home for per-instance debugging | Expect a filter step on each query; pair it with a label selector to limit the data scanned |
| Trace or request IDs (for context) | Never, because nearly every line has a unique value | Always the right home when you need to find one request | Lookups are precise, but broad aggregations over these fields are costly |
| Index label count limit | Confirm the default limit on index labels in the Loki docs before adding labels | Use this as the reason to move overflow attributes | Labels beyond the limit must be dropped or moved, so plan the set in advance |
How to change the default labels for one tenant
This sequence moves one tenant's OTLP resource attributes from index labels to structured metadata, which keeps that tenant's stream count bounded while its queries keep working. Each step ends with a check you can record before moving on. Work through it in a lower environment first, with the owners of the tenant's dashboards and alerts involved from the start.
Inventory tenants, streams and labels
Start by listing the tenants that send OTLP logs and confirming which ones identify themselves with the
X-Scope-OrgIDheader on every request. For the tenant you are changing, record which resource attributes, such ask8s.pod.nameandservice.instance.id, currently become index labels, and how many streams each label set produces over a typical day. Ask the platform team to export these figures from the Loki API or from metrics you already collect. Done when you have a per-tenant table of label names and stream counts to compare against after the change.Confirm TSDB and schema for structured metadata
Structured metadata depends on the storage layout, so check it before editing anything. Confirm that the index store is TSDB, which the Loki storage documentation recommends for Loki 2.8 and newer, and that the active schema configuration is one that supports structured metadata, as stated in the current Loki docs for your version. Read the schema block in the running configuration and compare it with the release you run. Done when the index store and schema version are written in your change record and match what the running cluster reports.
Set the per-tenant OTLP attribute mapping
Edit the per-tenant OTLP settings in Loki's limits so that only the chosen tenant stops promoting the high-cardinality attributes to index labels and keeps them as structured metadata. Place per-tenant overrides in the runtime overrides file so that one tenant changes without touching the others. Confirm the exact key names and defaults for your Loki version in the modify default labels guide before editing. Done when the configuration validates and the limits of a second tenant show no change.
Roll out the change through the log shipper
Confirm that the Grafana Alloy or OpenTelemetry Collector pipeline for this tenant sends the correct
X-Scope-OrgIDheader, then reload or restart the sender in one environment at a time. Alloy is Grafana's supported log shipper for Loki, and the Collector is vendor-neutral, so either can carry the change. The new mapping applies only to new log lines, so older streams keep their original labels. Done when a sample of new log lines from the tenant shows the attributes as structured metadata rather than as index labels.Verify stream counts after cutover
Compare the tenant's stream count over a window before the cutover with the same window after it, using the label names from your inventory. The count should fall, because the high-cardinality attributes no longer create a new stream for each pod or instance. If it does not fall, check the sender pipeline for another step that still promotes those attributes to labels. Watch the ingestion logs during the rollout for per-stream limit errors. Done when the count has settled at a level the tenant owner accepts and no new limit errors appear.
Verify query results in Grafana
Run the queries that dashboards and alerts depend on for a window before the cutover, using the old label selectors, then run the same queries for the same window using structured metadata filters. The results should match. Any query that used
k8s.pod.nameas a stream selector needs a rewrite to filter on structured metadata, so list those queries and their owners now. Done when every critical query returns matching results and each owner has signed off in your change record.Document the change and rollback path
Record the cutover time, the exact limit values, the sender configuration, and the before and after stream counts in the change record. Keep the previous limit values ready so the attribute mapping can be reverted in the runtime overrides file if ingestion or queries break. Logs written before the change keep their original labels, so queries that span the cutover need both selectors until retention removes the older data. Done when the rollback steps have been tested in a lower environment and the record is filed.
What changes for queries and dashboards after the switch
Existing LogQL queries, dashboards and alert rules that select on k8s_pod_name, service_instance_id or similar promoted labels will stop matching once those attributes are no longer indexed. Each of those selectors needs a rewrite that moves the condition into a structured metadata filter, or into a line filter where the value appears in the log body. Start by inventorying every query source you own, including Grafana panels, saved Explore queries, recording rules, alerting rules and any runbook or automation that builds LogQL strings. Search for the label names rather than trusting dashboard titles, because a single shared variable often feeds dozens of panels. Confirm the exact label and metadata field names in your own Loki version before editing anything, since the names your Collector emits depend on your pipeline configuration.
Data ingested before the change keeps its old layout. Chunks already in object storage still carry the labels they were written with, so a query over a window that spans the cutover may return results only for the older streams, or only for the newer ones, depending on how the filters are written. Plan for dashboards to show a visible seam at the cutover time and decide whether that is acceptable for incident review and audit purposes. If you need continuous history on the old keys, keep an old-style query path for the retention period and document it. Confirm with your own retention settings how long pre-change data remains queryable, because that determines how long the dual query path must exist.
Test the rewritten queries and alerts in a non-production tenant before cutover. Create a separate tenant ID, send it a copy of representative traffic through the same Collector pipeline you intend to use in production, and run each dashboard and alert against it with the new filters. Compare the result counts with the old queries against a known event, such as a deliberate test error from a named pod. Check that alert rules fire on the expected condition and that they do not return empty results silently, which is the most common failure mode after label changes. Record the outcome for each query so the cutover review has evidence, and confirm the tenant setup matches production limits so that ingestion problems do not appear only at scale.
Security and operational risks of changing label configuration
Changing which OpenTelemetry attributes Loki indexes touches tenant boundaries, who can edit configuration, what your audit trail contains and how long data stays readable. Each risk below is one to confirm before the change reaches production.
Tenant isolation when scoped per tenant
Per-tenant overrides let one tenant move k8s.pod.name out of the index while others keep it. Confirm that each override applies only to the intended X-Scope-OrgID and that no shared or default block changes the behaviour for tenants you did not plan to touch. Check that queries from one tenant cannot reach metadata written under another tenant's settings. Loki identifies tenants by that header only when auth_enabled is true, so verify that your reverse proxy sets and enforces it.
Access control on configuration changes
Label settings live in the Loki configuration and runtime overrides, so anyone who can edit them can change how every stream is indexed. Restrict write access to the configuration repository and deployment pipeline, and require review for label changes. Loki has no built-in authentication layer, so confirm that the admin endpoints are not reachable through the same path that serves tenant queries. Record who changed the setting and when.
Effect on audit trails and log content
Moving an attribute from an index label to structured metadata changes how it is stored and queried, not the log line itself. Queries that filter on the old label will return different results after the change, which can affect alerts, dashboards and audit searches built on those labels. Before the change, list every saved query, alert rule and audit report that references the attribute. Confirm that the audit records you must keep still carry the identifiers you need after the switch.
Retention interaction
Retention is applied by the compactor and is disabled by default, so logs stay until you enable it. Data written before the change keeps its original label layout, and data written after keeps the new one, so a query across the boundary may behave differently. Decide how long each side of the change must remain searchable and confirm that your retention rules, including any per-stream selectors, still match the streams you intend to delete. Retention rules have a minimum of 24 hours per stream rule.
Loki retention docsCost of rolling back
A rollback reverses the label configuration, but chunks already written keep the layout they were stored with. Plan for a period where both layouts exist and where queries must work across them. Estimate the engineering time to update dashboards and alert rules twice, and the storage cost of keeping data you may not otherwise retain. Ask your implementation partner or your own team to write the rollback steps and test them in a non-production tenant first.
Common questions before changing Loki's OTLP labels
Is changing Loki's default OpenTelemetry labels a configuration change or a migration?
It starts as a configuration change, but it becomes a migration once dashboards and alerts depend on the old label names. Loki lets you adjust which OTLP resource attributes are promoted to index labels, and moving k8s.pod.name and service.instance.id out of the index is a settings change. The work that takes time is everything around it: finding which queries select on those labels, rewriting them to use structured metadata or line filters, and confirming that new streams behave correctly. Grafana has not deprecated these attributes, so existing setups keep working until you decide to change them. Read the Loki documentation on modifying default labels before deciding which path fits your environment.
What drives the effort of changing OTLP labels in Loki?
Effort grows with the number of places that depend on the labels being indexed. The main drivers are the number of tenants, since each tenant may have its own limits and label configuration, the number of Grafana dashboards that filter on pod or instance labels, the number of alert and recording rules, and the number of Collector pipelines that set or rename resource attributes. A small cluster with one tenant and a few dashboards is a short exercise. A multi-team platform with shared dashboards and many rules needs an inventory, a staged rollout and a review of each query owner's workflow. Ask any partner to list those counts in the scoping conversation so the estimate reflects your actual setup.
Can our own team change Loki's default OpenTelemetry labels without outside help?
Yes, if you have an engineer who can read Loki configuration, run queries in Grafana and review Collector pipeline output. The configuration change itself is small. The harder parts are auditing existing LogQL queries, dashboards and alert rules for label selectors, testing the new structured metadata queries, and coordinating with teams who rely on the current labels. Teams without someone who knows Loki's schema and query behavior often find the audit takes longer than expected. A practical approach is to pilot the change in a non-production tenant, record which queries break, and then decide whether to finish in-house or bring in help for the remaining work.
What does the work need from our team before it starts?
The work needs access and people more than budget. Plan for read and change access to the Loki configuration and the deployment that runs it, access to the OpenTelemetry Collector configuration that produces the resource attributes, and Grafana access that lets someone export or review existing dashboards and alert rules. Sample log data from each relevant tenant helps confirm what labels appear today. You also need named query owners for the main dashboards and alerts, who can say which filters are essential and who will test after the change. Confirm the Loki version you run before scoping, because label and schema behavior depends on it.
Does changing the labels rewrite our existing log data in Loki?
No. Changing which attributes Loki promotes to index labels affects how new data is indexed from the point of change. Logs already stored keep their existing labels and content, and the change does not rewrite stored chunks or the index for older data. This matters for planning: queries over historical time ranges will still reflect the old label layout, so dashboards that span the change date may need both old and new selectors during a transition. Confirm this behavior for your Loki version and storage setup in the official documentation, and test a query across the change boundary before you rely on it.
What does a partner's fixed-scope quote for this work cover?
A fixed-scope quote covers the agreed scope, deliverables and timeline written down before work starts. For this topic, ask that it lists the Loki versions and deployment mode in scope, the tenants affected, the inventory of dashboards, alert rules and Collector pipelines to review, the label configuration changes, the structured metadata query updates, the test plan across the change boundary, and the handover notes for query owners. It should also state what is excluded, such as changes to unrelated Collector components or Grafana plugins. DeployOpen does not publish a price list, so a quote follows from that written scope.
Should we keep k8s.pod.name and service.instance.id as index labels?
Keep them only if your queries truly need them and the number of unique values stays manageable. Grafana no longer recommends indexing these attributes by default because their values are high cardinality, meaning they create many distinct streams. Each extra stream adds index and chunk overhead. For most teams, filtering by a stable label such as namespace, app or cluster is enough, and pod-level detail can be stored as structured metadata or filtered from line content. Test the trade-off against real queries from your query owners before you decide, and document the decision so future Collector changes do not quietly reintroduce the labels.
How DeployOpen scopes and delivers Loki label changes
DeployOpen treats a change to Loki's default OpenTelemetry labels as a platform change with data consequences, not a config tweak. We scope it in writing, build and test it against your own OTLP traffic, and hand over the configuration, evidence and runbook your teams need to operate it.
How we scope
- Inventory which OTLP resource attributes your pipelines currently promote to index labels in each tenant.
- Agree in writing which attributes move to structured metadata and which stay as labels.
- Confirm your Loki version, deployment mode and object storage before any configuration change is planned.
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
How we build
- Change the default label mapping in a non-production Loki environment that mirrors your ingestion path.
- Test queries that filter on the moved attributes, confirming they still return the expected log lines.
- Set per-tenant configuration so each team's label changes are scoped and reversible.
- Check stream counts and ingestion behavior against the baseline captured before the change.
How we hand over
- Deliver the tested configuration files, the tenant-by-tenant change record and the rollback steps.
- Document which LogQL queries and Grafana dashboards need updating after attributes move to metadata.
- Walk your platform and observability teams through the new label model and its trade-offs.
- Provide a runbook for adding new attributes to labels or metadata as your services change.
How we support
- Review label and stream behavior after rollout to confirm the change holds under production traffic.
- Retest the configuration when Loki or your OpenTelemetry Collector versions are upgraded.
- Ongoing support, upgrades and continuous testing are available as a retainer, scoped in writing.

