What the Loki service_name label does and when you need to tune it
If you run self-hosted Loki 3.0 or later and see a service_name label you did not define, Loki added it. Loki 3.0 automatically assigns a service_name label to all ingested logs by default, and Grafana relies on that label for exploration. Grafana states that a service name is required by OpenTelemetry semantic conventions and is being built into its user interface and query experiences, so the label is expected to be present on your streams. The Loki upgrade guide is the place to confirm how the value is derived and which settings control it in your version.
Teams moving from 2.x should treat this as a change to their stream set, not only a new field. Existing dashboards, alert rules and saved Grafana Explore selectors may now match streams differently once service_name is present, and queries that filter on other labels can return different results. Before upgrading, export the label names your queries depend on, run them against a test tenant on 3.x, and compare the results. Ask your Loki operator or vendor to show exactly which source attribute or log field feeds the value for each shipper you run.
The default matters for cardinality because service_name is an index label. Each distinct value creates its own set of streams, so if the source value varies per pod, per request or per deployment revision, the label can multiply your streams without anyone noticing. Check the distinct values per tenant and per source, and look for logs that arrive without a service name and receive a generic fallback. For those sources, decide whether to set a bounded value explicitly in your collector pipeline, using the OpenTelemetry resource attribute your shipper already sets, and confirm the change in a staging environment before rollout.
How service_name behaves by log source
Application logs that already carry a service or application name are the simplest case. Loki 3.0 assigns a service_name label to every ingested stream by default, so these streams should show a service_name value in Grafana's Explore view without extra configuration. The question is whether that value matches the name your teams use everywhere else, such as dashboards, alerts and runbooks. If the value differs, the label set by your shipper or the Loki service name settings is the first place to look.
- Expected value: the service name your application or deployment already uses, visible in the label browser for each stream.
- Consistency check: the same service should not appear under two names, for example one from a container name and one from a deployment name.
- Label source: confirm which label your shipper sends and whether Loki promotes it, using the service name settings described in the upgrade guide.
- Naming scheme: agree on one lowercase, stable name per service before rollout, because renaming later splits the history.
- Query test: filter on the service_name value and confirm that the lines returned belong to that service only.
If the names agree across your sources, Grafana's service-based views will group your logs in a way people recognize. Check a sample of streams from each team before you treat this source as done.
Logs sent over OpenTelemetry (OTLP) carry resource attributes that describe the sender. The OpenTelemetry semantic conventions define service.name as the attribute for the logical service, and Grafana states that a service name is required by those conventions. Loki maps this attribute into the service_name label, so the value you set in the SDK or Collector resource is the value you should see in Grafana. Where service.name is missing, the value Loki shows will not reflect your application, so the resource configuration is the thing to verify.
- Expected value: the service.name set in the OpenTelemetry resource, carried into service_name for each stream.
- SDK and Collector check: confirm service.name is set in the application SDK or in the Collector resource processor, not only in individual log records.
- Attribute scope: keep service.name stable across replicas so that scaled-out pods do not create many service names.
- Other resource attributes: check which attributes become index labels in your version, since high-cardinality values such as instance identifiers should stay out of the index.
- Mixed senders: if some services send OTLP and others send plain logs, compare how each produces its service_name value.
Before you rely on these values in dashboards, send a test log from one service and confirm the label in Grafana matches the resource you configured. The official upgrade guide describes the OTLP defaults for your Loki version.
Container and host logs, collected from files, journald or a container runtime, often carry labels about the machine or runtime rather than the application. Loki still assigns service_name, but the value it derives depends on the labels your collector attaches. Several applications on one host or in one namespace may end up under one service_name, which makes exploration harder. Treat the value as a starting point and confirm it against the workloads you actually run.
- Expected value: a service_name derived from the labels your collector attaches, such as job or container-level labels, depending on your configuration.
- Collapsed services: check whether unrelated applications share one service_name value on the same host or namespace.
- Label set: list the labels your collector sends and decide which one identifies the application.
- Relabeling: where the default value is too broad, add a rule in the collector that sets a service name from a stable workload label.
- Cardinality: avoid using pod names or container IDs as the service name, since those change on every deployment.
After changing the collector, restart the sender, generate a few log lines from each workload and confirm that Grafana groups them as intended. Note that existing streams keep their old labels, so compare new data against the change date.
Legacy logs are sources shipped without useful labels, such as older appliances, scripts that write to a file or an agent with a minimal configuration. For these, the service_name value Loki shows is a fallback rather than a name that describes the application. Many unrelated sources can land under the same value, and exploration by service becomes unreliable. The fix belongs in the shipper, because Loki can only index what it receives, and existing streams will not change retroactively.
- Expected fallback: a generic value shared by many sources. Confirm the exact fallback in the documentation for your Loki version before you write queries against it.
- Inventory: list every legacy source and the labels it sends, so that you know which ones need work.
- Shipper change: add a stable service name in the shipper configuration for each source, using a label that identifies the application.
- Historical data: older streams keep their original labels, so queries across the change date will show two groups of values.
- Verification: compare line counts for one source before and after the change to confirm that no logs were dropped.
For sources you cannot change, plan to filter on another label or on line content instead. Record which sources remain unlabeled so that auditors and on-call staff know their logs are harder to scope.
How Grafana uses service_name in Explore and dashboards
Grafana is building its user interface and query experiences around the service_name label, and for most teams this is the natural starting point for browsing logs in Explore. Instead of first choosing a namespace, pod or container and then working out which application produced a line, a reader can begin with the service and narrow from there. Because Loki 3.0 assigns service_name to every stream by default, the label is present even when an application never set one, so the service picker in Explore should have something to show for each stream. Confirm this with your Grafana version, since the exact picker behavior, default filters and dashboard variables depend on it and Grafana updates these views between releases. The Loki upgrade guide explains the Loki 3.0 default that feeds this behavior.
The practical effect is on how people find logs during an incident. An on-call engineer who knows the service name can open Explore, select the service, and see its streams without remembering infrastructure labels that change with deployments. Dashboards that use a service_name variable can offer the same service list across teams, which makes panels easier to share. Plan for this by agreeing on one naming convention for services early, because a value such as payments-api and a value such as Payments API will appear as two separate services in the picker and split the views people rely on.
Before you rely on this in dashboards or runbooks, run a short check in your own environment. Send logs from one application that sets a service name and one that does not, then confirm in Explore which value appears for each. Check that dashboard variables populate, that saved queries still match after a Grafana upgrade, and that the label does not duplicate a value your teams already index. Decide who owns the naming list for services that do not carry a name at the source, because that decision determines how readable the service picker will be.
Configuration options for service_name and when each fits
This table compares the three ways to set service_name on Loki streams: accept the default, map an existing attribute in the shipper, or set a static value in the client. Read each row against the logs you actually ship, because the right choice depends on whether those logs already carry a usable service name.
| Option | Where it is set | When it fits | Trade-off |
|---|---|---|---|
| Accept the Loki 3.0 default | Loki, applied automatically to ingested logs | Logs already carry a clear service identity, such as OpenTelemetry resource attributes, and you want no pipeline changes | You depend on Loki's assignment logic, so confirm which source attribute it uses in your version before relying on the values |
| Map an attribute to service_name in the shipper | Grafana Alloy or OpenTelemetry Collector pipeline, using the attribute mapping or label stage your version supports | Your team already names workloads through a standard attribute, such as an application or deployment name, that differs from the default | Mapping adds pipeline configuration to maintain, and a mapping error can make many streams share one value; confirm exact component and key names for your release |
| Add a static service_name in the client | Client or agent configuration for the specific log source | Some sources, such as a legacy file tail or a network device, emit no service name and you need one fixed value per source | Static values do not change with the workload, so review them when a source is repurposed or renamed |
| Leave service_name unset for logs without an identity | Not configured | Logs are infrastructure-level and grouping them under one generic value is acceptable | Queries filtered by service_name will miss these streams, so use other labels such as namespace or host for them |
| Override in a tenant-wide setting | Loki limits configuration for the tenant, if your version exposes the relevant setting | You run multiple tenants and want consistent handling without changing every shipper | Tenant-level behaviour can differ by Loki version, so confirm the setting name and scope in the upgrade guide and configuration reference |
| Mix sources within one cluster | Combination of the options above, applied per pipeline | Different teams ship logs with different conventions | Inconsistent values make dashboards and alerts harder to write, so document one naming rule per team |
Configure service_name for logs without a service name
This sequence gives every log stream a stable, meaningful service_name so Grafana Explore and Loki metrics behave predictably. It starts with finding sources that lack a service identifier and ends with a per-environment rollout that you can check and reverse.
Inventory log sources without a service identifier
The platform team lists every log source that reaches Loki and marks those that carry no usable service name, such as bare host syslog, database logs, network device output and some legacy batch jobs. Record the shipper, the source type and the current labels for each one. Done means every source has an owner and a status, and you can point to the sources that will need an explicit value. Check the result by querying a sample of streams in Grafana Explore and confirming which ones show no meaningful service_name.
Choose a stable value source for each source type
For each source type, decide where the service name will come from: a file path or unit name, a container or workload label, a fixed value assigned in the shipper, or an OpenTelemetry resource attribute. The value must be stable across restarts, deployments and host moves, and it must be bounded, so one application cannot produce many values. Write the decision down with the owner who will maintain it. Done means each source type has one documented source and no two sources compete for the same identity.
Set the service name in the shipper configuration
The engineer who runs the shipper edits its configuration so the chosen value is attached to each stream. Grafana Alloy is the supported shipper for Loki, so start there, and confirm the exact component and key names against the Grafana Alloy and Loki send data documentation for your version. If you still run Promtail, plan the move to Alloy first, since Promtail has reached end of life. Keep the change in version control and apply it to one host or workload first. Done means the configuration validates and the shipper restarts cleanly.
Validate with a test log in Grafana Explore
The engineer writes a uniquely tagged test line from the changed source and searches for it in Grafana Explore, filtering on service_name. Confirm that the stream carries the expected value and that the line is not duplicated or split across unrelated values. Also confirm that the service_name shown in Explore matches what other teams will select. Done means the test line appears under the intended service_name and no unexpected values appear for that source.
Check stream count in Loki metrics
Before widening the change, the platform team compares the number of active streams for the affected tenant against the figure recorded in the inventory step. Use the Loki metrics and dashboards you already monitor to see stream growth. A new value taken from a field that changes often, such as a pod or instance identifier, will show up here as stream growth, so treat any unexpected rise as a signal to revisit the value source. Done means the stream count stays within the level you expected for the source.
Roll out per environment with a rollback path
The team applies the change in one environment at a time, starting with a non-production environment, then staging, then production, and repeats the validation and stream checks in each. Keep the previous shipper configuration available so you can restore it quickly if queries break or stream counts climb. Record the rollback steps in the change ticket. Confirm with the owners of dashboards and alerts that filters using service_name still match the new values, since existing queries built on the old labels may return nothing. Done means every environment passes the same checks and the rollback procedure has been tested once.
How a log line gets its service_name label
The diagram starts at the log source and follows the line through a shipper such as Grafana Alloy, the Loki distributor and ingester, and object storage, before Grafana Explore reads it back. Loki 3.0 applies a default service_name during ingestion, so the shipper's resource attributes and any explicit label setting decide the final value. Check the value at the shipper and again in Explore, because a line with no usable source attribute can end up with a derived or fallback name.
Where service_name is set, derived, or defaulted on the way to Grafana Explore.
Security and operational risks of mislabeled service names
The service_name label drives more than search. Loki uses labels to decide which streams a caller can reach, how many streams it indexes and which configuration changes reach production. The cards below cover the controls that keep those decisions intentional.
Access control depends on labels
If you use label-based access control, the labels a stream carries decide who can read it. A service name copied from a shared field, a pod name or a free-text tag can place logs in a group that should not see them. Before you grant access by label, sample the service_name values each team's shippers actually produce and confirm that every value maps to one owner. Label-based access control is a feature of Grafana Enterprise Logs, so confirm what your edition enforces.
Enterprise Logs docsTenant isolation with auth_enabled
Loki separates tenants only when auth_enabled is true, and it identifies each tenant from the X-Scope-OrgID header on every request. A service_name value does not create a tenant boundary. Confirm that auth_enabled is set in the running configuration, that every shipper sets the tenant header, and that no team can query another tenant by changing the header.
Multi-tenancy docsAuthentication in front of Loki
Loki has no built-in authentication layer. The Loki documentation says to place an authenticating reverse proxy, such as nginx, HAProxy, OAuth2 Proxy or Pomerium, in front of it. Without one, anyone who can reach the Loki port can query any service_name value. Confirm that the write path and query path are both behind the proxy and that Grafana connects through it.
Authentication docsCardinality cost of identifier values
Teams sometimes set service_name to a pod name, a user ID or a request ID because it is unique to the workload. Each new value creates a new stream, which increases index size, ingestion pressure and query cost. Review the number of distinct service_name values per tenant after each rollout, and move identifiers to structured metadata or line content.
Reviewing shipper configuration changes
Loki 3.0 assigns service_name automatically, and the value can change when an agent's relabeling rules, OpenTelemetry resource mapping or pipeline stages change. A one-line edit in an Alloy or Fluent Bit configuration can rename every stream a team queries. Treat shipper configuration as reviewed code, and require a reviewer to confirm the service_name result for each changed source before the change reaches production.
Auditing label values for sensitive data
A service_name value is stored as an index label and appears in stream listings, dashboards and alert names. If a team derives it from a hostname, email address, customer identifier or account number, that data becomes visible to everyone who can list label values. Run a periodic audit of distinct service_name values in each tenant, check for personal or regulated data, and record the review as evidence of how the label is controlled.
Questions teams ask before changing service_name
Can our own team configure the service_name label without a partner?
Yes, in most environments a platform or observability team can make the change itself, because the work is configuration in the log shipper and, where needed, in Grafana. Loki 3.0 assigns service_name to every ingested stream by default, so the first step is usually to check what your shippers already send. The team needs to know which sources set a service name, which do not, and how the value is derived for each. A partner adds value when the estimate has to be defended to a risk or audit committee, when many shippers and teams are involved, or when the change must be reviewed against a written scope before it reaches production. Ask whether your team has the time to test each source and to coordinate with the owners of the applications that produce the logs.
How long does a service_name rollout take?
The duration depends mainly on the number of log sources, how many teams own them, and which shipper and deployment tooling you use. A single Kubernetes cluster with one Grafana Alloy configuration is a very different job from dozens of hosts managed by separate teams with hand-edited agent files. Each source needs its labeling rule tested, its dashboards and saved queries checked, and its change rolled out through your normal release process. No duration is set by the product itself, so treat any figure in a proposal as an estimate that should trace back to a source inventory. Ask the partner or your team to list every shipper, its owner and its change path before agreeing a timeline. A fixed-scope review helps here because the inventory becomes the basis for the schedule.
What access and information does the work need from our team?
The work needs four kinds of access and information: the configuration of every log shipper that sends data to Loki, read access to the Grafana instances that users query, the tenant settings that map teams to Loki tenants, and a named owner for each source application. Shipper configuration tells you where service names come from today, whether from a Kubernetes label, a systemd unit, an OpenTelemetry resource attribute or a hard-coded value. Grafana access shows which dashboards, alerts and Explore workflows depend on the current label values. Tenant settings matter when separate teams query separate tenants with the X-Scope-OrgID header. Confirm with your security team how that access is granted and recorded before the work begins.
Does changing service_name rewrite the logs we already stored?
No, a change to the label applies to new log entries from the point the new configuration takes effect. Loki does not rewrite chunks that are already in object storage, so historical data keeps the labels it was written with. This has two consequences. Queries that span the change will see two sets of values, and dashboards built on the new label will show little or no history until the old data ages out of retention. Retention is applied by the compactor and is disabled by default, so you should check your retention settings to understand how long the older values remain queryable. Plan a short overlap period in which both the old and new labels are visible, and document it for the users who rely on historical searches.
What drives the cost of changing the service_name label?
The main cost components are the people who inventory sources, change and test shipper configuration, update dashboards and alerts, and coordinate rollouts, plus the storage and compute that Loki uses for the streams you create. Stream count matters because each unique combination of labels creates a separate stream, so a poorly chosen service_name value can multiply streams and increase index and chunk overhead. Storage is largely one-time for the change itself but recurs as long as logs are kept, which is why retention settings affect the ongoing bill. Ask any quote to separate one-time labor from recurring infrastructure, to state how many sources are in scope, and to show how stream growth was estimated. Ask your own team to pull current stream counts before the work starts, because those numbers are the baseline for any cost comparison.
When should we hire a partner for a fixed-scope review?
Consider a fixed-scope review when the label change touches many sources, when logs carry compliance or audit requirements, or when your team lacks the bandwidth to run the inventory and testing alongside daily operations. A review of this kind usually covers the current label behavior, a source inventory, the proposed labeling rules, a test plan and a rollout sequence, all agreed in writing before work starts. DeployOpen implements, customizes and documents self-hosted open-source platforms in your infrastructure, so the review can feed directly into the configuration work if you choose. Ask for the scope, deliverables and timeline in writing, and confirm who signs off on each change before you commit.
Which log shippers need checking before we change service_name?
Check every shipper that sends logs to Loki, because each one can set or omit the service name differently. Grafana Alloy is Grafana's supported log shipper for Loki, and Loki also accepts Fluent Bit, Fluentd, the Docker logging driver and OpenTelemetry logs over HTTP. Promtail reached end of life on March 2, 2026, so any Promtail agents should be scheduled for migration to Grafana Alloy rather than changed in place. For each shipper, record where the service name is set, whether it is derived from a container or pod name, and what happens when the source does not supply one. Logs without a service name are the cases that need an explicit default, so list them early and assign an owner to each.
How DeployOpen works on this
DeployOpen plans and implements self-hosted Loki inside your own infrastructure, including how the service_name label is derived, displayed in Grafana and configured for logs that arrive without a service name. Work starts from a written scope, and each step is documented so your team can review and run the result.
How we scope
- Inventory which log sources already set a service name and which ones arrive without one, such as bare host logs and legacy appliances.
- Agree in writing which Grafana Explore views and dashboards depend on service_name and need to keep working after the change.
- Confirm the Loki version, deployment mode and Alloy or other shipper versions in use before any configuration is planned.
- Fixed-scope engagements set the deliverables and timeline in writing before work begins, and a quote follows from that scope.
How we build
- Map each log source to its service_name derivation path and document the fallback value used when no service name is present.
- Configure Alloy or the relevant pipeline to set or override service_name for unlabelled streams, and test the result with sample logs.
- Check that label cardinality stays bounded after the change, so the service_name value does not add unplanned streams.
- Validate Grafana Explore queries and saved views against the new label values in a staging environment before rollout.
How we hand over
- Deliver a written configuration record covering the source-to-label mapping, fallback rules and the reason for each override.
- Provide test queries and a short runbook so your team can confirm service_name values after future log source changes.
- Walk your platform and observability engineers through the configuration and the checks that show whether labels are healthy.
- Document any open decisions, such as naming conventions for services, so they can be closed by your owners.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, which can cover Loki version changes that affect labels.
- Review service_name behavior again when you add new log sources, change shippers or move to a later Loki release.
- Confirm with your team who owns service naming standards, so changes after handover go through the same review path.

