---
title: "otelcol.exporter.logging | Grafana Agent documentation"
description: "Learn about otelcol.exporter.logging"
---

# 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](../../config-blocks/logging/) 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

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
otelcol.exporter.logging "LABEL" { }
```

## Arguments

`otelcol.exporter.logging` supports the following arguments:

Expand table

| Name                  | Type     | Description                                          | Default    | Required |
|-----------------------|----------|------------------------------------------------------|------------|----------|
| `verbosity`           | `string` | Verbosity of the generated logs.                     | `"normal"` | no       |
| `sampling_initial`    | `int`    | Number of messages initially logged each second.     | `2`        | no       |
| `sampling_thereafter` | `int`    | Sampling rate after the initial messages are logged. | `500`      | no       |

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

## Blocks

The following blocks are supported inside the definition of `otelcol.exporter.logging`:

Expand table

| Hierarchy      | Block                                  | Description                                                                | Required |
|----------------|----------------------------------------|----------------------------------------------------------------------------|----------|
| debug\_metrics | [debug\_metrics](#debug_metrics-block) | Configures the metrics that this component generates to monitor its state. | no       |

The `>` symbol indicates deeper levels of nesting. For example, `client > tls` refers to a `tls` block defined inside a `client` block.

### debug\_metrics block

The `debug_metrics` block configures the metrics that this component generates to monitor its state.

The following arguments are supported:

Expand table

| Name                               | Type      | Description                                          | Default | Required |
|------------------------------------|-----------|------------------------------------------------------|---------|----------|
| `disable_high_cardinality_metrics` | `boolean` | Whether to disable certain high cardinality metrics. | `true`  | no       |

`disable_high_cardinality_metrics` is the Grafana Agent equivalent to the `telemetry.disableHighCardinalityMetrics` feature gate in the OpenTelemetry Collector. It removes attributes that could cause high cardinality metrics. For example, attributes with IP addresses and port numbers in metrics about HTTP and gRPC connections are removed.

## Exported fields

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

Expand table

| Name    | Type               | Description                                                      |
|---------|--------------------|------------------------------------------------------------------|
| `input` | `otelcol.Consumer` | A 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:

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
prometheus.exporter.unix "default" { }

prometheus.scrape "default" {
    targets    = prometheus.exporter.unix.default.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
}
```

## Compatible components

`otelcol.exporter.logging` has exports that can be consumed by the following components:

- Components that consume [OpenTelemetry `otelcol.Consumer`](../../compatibility/#opentelemetry-otelcolconsumer-consumers)

> Note
> 
> Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.
