Loki Exporter
Overview
Exports data via HTTP to Loki.Getting Started
The following settings are required:endpoint(no default): The target URL to send Loki log streams to (e.g.:http://loki:3100/loki/api/v1/push).
Configuration via attribute hints
Labels
The Loki exporter can convert OTLP resource and log attributes into Loki labels, which are indexed. For that, you need to configure hints, specifying which attributes should be placed as labels. The hints are themselves attributes and will be ignored when exporting to Loki. The following example uses theattributes processor to hint the Loki exporter to set the event.domain
attribute as label and the resource processor to give a hint to the Loki exporter to set the service.name as label.
job=service.namespace/service.nameinstance=service.instance.idexporter=OTLP
exporter=OTLP is always set.
If service.name and service.namespace are present then job=service.namespace/service.name is set
If service.name is present and service.namespace is not present then job=service.name is set
If service.name is not present and service.namespace is present then job label is not set
If service.instance.id is present then instance=service.instance.id is set
If service.instance.id is not present then instance label is not set
The full list of settings exposed for this exporter are documented here with detailed sample
configurations here.
More information on how to send logs to Grafana Loki using the OpenTelemetry Collector could be found here
Tenant information
It is recommended to use theheader_setter extension to configure the tenant information to send to Loki. In case a static tenant
should be used, you can make use of the headers option for regular HTTP client settings, like the following:
loki.tenant attribute hint that specifies
which resource or log attributes value should be used as a tenant. For example:
host.name resource attribute is used to group logs
by tenant and send requests with the X-Scope-OrgID header set to relevant tenants.
If the loki.tenant hint attribute is present in both resource or log attributes,
then the look-up for a tenant value from resource attributes takes precedence.
Format
To choose the format used for writing log lines by the exporter use theloki.format hint. For example:
logfmt: Write logs as logfmt lines.json: Write logs as JSON objects. It is the default format if no hint is present.raw: Write the body of the log message as string representation.
Severity
OpenTelemetry usesrecord.severity to track log levels where loki uses record.attributes.level for the same. The exporter automatically maps the two, except if a “level” attribute already exists.
Deprecated configuration
The following options are now deprecated:labels.{attributes/resource}. Deprecated and will be removed by v0.59.0. See the Labels section for more information.labels.record. Deprecated and will be removed by v0.59.0. See the Labels section for more information.tenant: Deprecated and will be removed by v0.59.0. See the Tenant information section for more information.formatDeprecated without replacement. See the Format section for more information.
Advanced Configuration
Several helper files are leveraged to provide additional capabilities automatically:Configuration
Example Configuration
Last generated: 2026-04-14