Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. 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.
otelcol.receiver.loki
BETA: This is a beta component. Beta components are subject to breaking changes, and may be replaced with equivalent functionality that cover the same use case.
otelcol.receiver.loki
receives Loki log entries, converts them to the
OpenTelemetry logs format, and forwards them to other otelcol.*
components.
Multiple otelcol.receiver.loki
components can be specified by giving them
different labels.
Usage
otelcol.receiver.loki "LABEL" {
output {
logs = [...]
}
}
Arguments
otelcol.receiver.loki
doesn’t support any arguments and is configured fully
through inner blocks.
Blocks
The following blocks are supported inside the definition of
otelcol.receiver.loki
:
Hierarchy | Block | Description | Required |
---|---|---|---|
output | output | Configures where to send converted telemetry data. | yes |
output block
The output
block configures a set of components to forward resulting
telemetry data to.
The following arguments are supported:
Name | Type | Description | Default | Required |
---|---|---|---|---|
metrics | list(otelcol.Consumer) | List of consumers to send metrics to. | [] | no |
logs | list(otelcol.Consumer) | List of consumers to send logs to. | [] | no |
traces | list(otelcol.Consumer) | List of consumers to send traces to. | [] | no |
The output
block must be specified, but all of its arguments are optional. By
default, telemetry data is dropped. To send telemetry data to other components,
configure the metrics
, logs
, and traces
arguments accordingly.
Exported fields
The following fields are exported and can be referenced by other components:
Name | Type | Description |
---|---|---|
receiver | LogsReceiver | A value that other components can use to send Loki logs to. |
Component health
otelcol.receiver.loki
is only reported as unhealthy if given an invalid
configuration.
Debug information
otelcol.receiver.loki
does not expose any component-specific debug
information.
Example
This example uses the otelcol.receiver.loki
component as a bridge
between the Loki and OpenTelemetry ecosystems. The component exposes a
receiver which the loki.source.file
component uses to send Loki log entries
to. The logs are converted to the OTLP format before they are forwarded
to the otelcol.exporter.otlp
component to be sent to an OTLP-capable
endpoint:
loki.source.file "default" {
targets = [
{__path__ = "/tmp/foo.txt", "loki.format" = "logfmt"},
{__path__ = "/tmp/bar.txt", "loki.format" = "json"},
]
forward_to = [otelcol.receiver.loki.default.receiver]
}
otelcol.receiver.loki "default" {
output {
logs = [otelcol.exporter.otlp.default.input]
}
}
otelcol.exporter.otlp "default" {
client {
endpoint = env("OTLP_ENDPOINT")
}
}