Caution

Grafana Agent has reached End-of-Life (EOL) on November 1, 2025. Agent is no longer receiving vendor support and will no longer receive security or bug fixes. Current users of Agent Static mode, Agent Flow mode, and Agent Operator should proceed with migrating to Grafana Alloy. If you have already migrated to Alloy, no further action is required. Read more about why we recommend migrating to Grafana Alloy.

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source

otelcol.exporter.loki

otelcol.exporter.loki accepts OTLP-formatted logs from other otelcol components, converts them to Loki-formatted log entries, and forwards them to loki components.

NOTE: otelcol.exporter.loki is a custom component unrelated to the lokiexporter from the OpenTelemetry Collector.

Conversion of logs are done according to the OpenTelemetry Logs Data Model specification.

Multiple otelcol.exporter.loki components can be specified by giving them different labels.

Usage

Alloy
otelcol.exporter.loki "LABEL" {
  forward_to = [...]
}

Arguments

otelcol.exporter.loki supports the following arguments:

NameTypeDescriptionDefaultRequired
forward_tolist(receiver)Where to forward converted Loki logs.yes

Exported fields

The following fields are exported and can be referenced by other components:

NameTypeDescription
inputotelcol.ConsumerA value that other components can use to send telemetry data to.

input accepts otelcol.Consumer data for logs. Other telemetry signals are ignored.

Logs sent to input are converted to Loki-compatible log entries and are forwarded to the forward_to argument in sequence.

Component health

otelcol.exporter.loki is only reported as unhealthy if given an invalid configuration.

Debug information

otelcol.exporter.loki does not expose any component-specific debug information.

Example

This example accepts OTLP logs over gRPC, transforms them and forwards the converted log entries to loki.write:

Alloy
otelcol.receiver.otlp "default" {
  grpc {}

  output {
    logs = [otelcol.exporter.loki.default.input]
  }
}

otelcol.exporter.loki "default" {
  forward_to = [loki.write.local.receiver]
}

loki.write "local" {
    endpoint {
        url = "loki:3100"
    }
}