Menu

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.

Open source

otelcol.exporter.logging

otelcol.exporter.logging accepts telemetry data from other otelcol components and writes them to the console.

This component writes logs at the info level. The logging config block must be configured to write logs at the info level.

NOTE: otelcol.exporter.logging is a wrapper over the upstream OpenTelemetry Collector logging exporter. Bug reports or feature requests will be redirected to the upstream repository, if necessary.

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

Usage

river
otelcol.exporter.logging "LABEL" { }

Arguments

otelcol.exporter.logging supports the following arguments:

NameTypeDescriptionDefaultRequired
verbositystringVerbosity of the generated logs."normal"no
sampling_initialintNumber of messages initially logged each second.2no
sampling_thereafterintSampling rate after the initial messages are logged.500no

The verbosity argument must be one of "basic", "normal", or "detailed".

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 any telemetry signal (metrics, logs, or traces).

Component health

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

Debug information

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

Example

This example scrapes prometheus unix metrics and writes them to the console:

river
prometheus.exporter.unix { }

prometheus.scrape "default" {
	targets    = prometheus.exporter.unix.targets
	forward_to = [otelcol.receiver.prometheus.default.receiver]
}

otelcol.receiver.prometheus "default" {
	output {
		metrics = [otelcol.exporter.logging.default.input]
	}
}

otelcol.exporter.logging "default" {
	verbosity           = "detailed"
	sampling_initial    = 1
	sampling_thereafter = 1
}