---
title: "otelcol.exporter.awss3 | Grafana Alloy documentation"
description: "Learn about otelcol.exporter.awss3"
---

# `otelcol.exporter.awss3`

> **EXPERIMENTAL**: This is an [experimental](/docs/release-life-cycle/) component. Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement. To enable and use an experimental component, you must set the `stability.level` [flag](/docs/alloy/latest/reference/cli/run/) to `experimental`.

`otelcol.exporter.awss3` accepts telemetry data from other `otelcol` components and writes them to an AWS S3 bucket.

> Note
> 
> `otelcol.exporter.awss3` is a wrapper over the upstream OpenTelemetry Collector [`awss3`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.147.0/exporter/awss3exporter) exporter. Bug reports or feature requests will be redirected to the upstream repository if necessary.

You can specify multiple `otelcol.exporter.awss3` components by giving them different labels.

## Usage

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

```alloy
otelcol.exporter.awss3 "<LABEL>" {
  s3_uploader {
    region = "<AWS_REGION>"
    s3_bucket = "<S3_BUCKET_NAME>"
    s3_prefix = "<PREFIX_FOR_S3_KEY>"
  }
}
```

## Arguments

You can use the following argument with `otelcol.exporter.awss3`:

Expand table

| Name      | Type       | Description                                      | Default | Required |
|-----------|------------|--------------------------------------------------|---------|----------|
| `timeout` | `duration` | Time to wait before marking a request as failed. | `"5s"`  | no       |

## Blocks

You can use the following blocks with `otelcol.exporter.awss3`:

No valid configuration blocks found.

### `s3_uploader`

Required

The `s3_uploader` block configures the AWS S3 bucket details used by the component.

The following arguments are supported:

Expand table

| Name                    | Type       | Description                                                                                                                                                       | Default                                       | Required |
|-------------------------|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|----------|
| `s3_bucket`             | `string`   | The S3 bucket.                                                                                                                                                    |                                               | yes      |
| `s3_prefix`             | `string`   | Prefix for the S3 key (directory inside the bucket), appended to `s3_base_prefix` if provided.                                                                    |                                               | yes      |
| `acl`                   | `string`   | The canned ACL to use when uploading objects.                                                                                                                     | `"private"`                                   | no       |
| `compression`           | `string`   | File compression method, `none` or `gzip`                                                                                                                         | `"none"`                                      | no       |
| `disable_ssl`           | `boolean`  | Set this to `true` to disable SSL when sending requests.                                                                                                          | `false`                                       | no       |
| `endpoint`              | `string`   | Overrides the endpoint used by the exporter instead of constructing it from `region` and `s3_bucket`.                                                             |                                               | no       |
| `file_prefix`           | `string`   | The file prefix defined by the user.                                                                                                                              |                                               | no       |
| `region`                | `string`   | The AWS region.                                                                                                                                                   | `"us-east-1"`                                 | no       |
| `retry_max_attempts`    | `int`      | The max number of attempts for retrying a request.                                                                                                                | `3`                                           | no       |
| `retry_max_backoff`     | `duration` | The max backoff delay that can occur before retrying a request.                                                                                                   | `20s`                                         | no       |
| `retry_mode`            | `string`   | The retryer implementation.                                                                                                                                       | `"standard"`                                  | no       |
| `role_arn`              | `string`   | The Role ARN to be assumed.                                                                                                                                       |                                               | no       |
| `s3_base_prefix`        | `string`   | Prefix for the S3 key (root directory inside the bucket).                                                                                                         |                                               | no       |
| `s3_force_path_style`   | `boolean`  | Set this to `true` to force the request to use [path-style requests](https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#path-style-access) | `false`                                       | no       |
| `s3_partition_format`   | `string`   | Filepath formatting for the partition; Refer to [`strftime`](https://www.man7.org/linux/man-pages/man3/strftime.3.html) for format specification.                 | `"year=%Y/month=%m/day=%d/hour=%H/minute=%M"` | no       |
| `s3_partition_timezone` | `string`   | Timezone used for partition time. Local timezone is used if not configured.                                                                                       |                                               | no       |
| `storage_class`         | `string`   | The storage class to use when uploading objects.                                                                                                                  | `"STANDARD"`                                  | no       |
| `unique_key_func_name`  | `string`   | Function used to generate the unique part of the S3 key. The only supported value is `uuidv7`.                                                                    |                                               | no       |

`retry_mode` must be one of `standard`, `adaptive`, or `nop`. If `retry_mode` is set to `nop`, the `aws.NopRetryer` implementation effectively disables the retry. Setting `retry_max_attempts` to 0 will allow the SDK to retry all retryable errors until the request succeeds, or a non-retryable error is returned.

### `debug_metrics`

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 Alloy 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.

> Note
> 
> If configured, `disable_high_cardinality_metrics` only applies to `otelcol.exporter.*` and `otelcol.receiver.*` components.

### `marshaler`

Marshaler determines the format of data sent to AWS S3. Currently, the following marshalers are implemented:

- `otlp_json` (default): the [OpenTelemetry Protocol format](https://github.com/open-telemetry/opentelemetry-proto), represented as JSON.
- `otlp_proto`: the [OpenTelemetry Protocol format](https://github.com/open-telemetry/opentelemetry-proto), represented as Protocol Buffers. A single protobuf message is written into each object.
- `sumo_ic`: the [Sumo Logic Installed Collector Archive format](https://help.sumologic.com/docs/manage/data-archiving/archive/). **This format is supported only for logs.**
- `body`: export the log body as string. **This format is supported only for logs.**

The following arguments are supported:

Expand table

| Name   | Type     | Description                            | Default       | Required |
|--------|----------|----------------------------------------|---------------|----------|
| `type` | `string` | Marshaler used to produce output data. | `"otlp_json"` | no       |

### `sending_queue`

The `sending_queue` block configures queueing and batching for the exporter.

The following arguments are supported:

Expand table

| Name                | Type                       | Description                                                                                | Default      | Required |
|---------------------|----------------------------|--------------------------------------------------------------------------------------------|--------------|----------|
| `block_on_overflow` | `boolean`                  | The behavior when the component’s `TotalSize` limit is reached.                            | `false`      | no       |
| `enabled`           | `boolean`                  | Enables a buffer before sending data to the client.                                        | `true`       | no       |
| `num_consumers`     | `number`                   | Number of readers to send batches written to the queue in parallel.                        | `10`         | no       |
| `queue_size`        | `number`                   | Maximum number of unwritten batches allowed in the queue at the same time.                 | `1000`       | no       |
| `sizer`             | `string`                   | How the queue and batching is measured.                                                    | `"requests"` | no       |
| `wait_for_result`   | `boolean`                  | Determines if incoming requests are blocked until the request is processed or not.         | `false`      | no       |
| `storage`           | `capsule(otelcol.Handler)` | Handler from an `otelcol.storage` component to use to enable a persistent queue mechanism. |              | no       |

The `blocking` argument is deprecated in favor of the `block_on_overflow` argument.

When `block_on_overflow` is `true`, the component will wait for space. Otherwise, operations will immediately return a retryable error.

When `enabled` is `true`, data is first written to an in-memory buffer before sending it to the configured server. Batches sent to the component’s `input` exported field are added to the buffer as long as the number of unsent batches doesn’t exceed the configured `queue_size`.

`queue_size` determines how long an endpoint outage is tolerated. Assuming 100 requests/second, the default queue size `1000` provides about 10 seconds of outage tolerance. To calculate the correct value for `queue_size`, multiply the average number of outgoing requests per second by the time in seconds that outages are tolerated. A very high value can cause Out Of Memory (OOM) kills.

The `sizer` argument could be set to:

- `requests`: number of incoming batches of metrics, logs, traces (the most performant option).
- `items`: number of the smallest parts of each signal (spans, metric data points, log records).
- `bytes`: the size of serialized data in bytes (the least performant option).

The `num_consumers` argument controls how many readers read from the buffer and send data in parallel. Larger values of `num_consumers` allow data to be sent more quickly at the expense of increased network traffic.

If an `otelcol.storage.*` component is configured and provided in the queue’s `storage` argument, the queue uses the provided storage extension to provide a persistent queue and the queue is no longer stored in memory. Any data persisted will be processed on startup if Alloy is killed or restarted. Refer to the [exporterhelper documentation](https://github.com/open-telemetry/opentelemetry-collector/blob/v0.147.0/exporter/exporterhelper/README.md#persistent-queue) in the OpenTelemetry Collector repository for more details.

### `batch`

The `batch` block configures batching requests based on a timeout and a minimum number of items.

Batching is disabled by default. To enable it, explicitly include `batch {}` in your Alloy configuration. You do not need to include a `batch {}` block in your `otelcol.exporter` if you already use a `otelcol.processor.batch` component, although batching in the exporter is the preferred method because it is more flexible.

The following arguments are supported:

Expand table

| Name            | Type       | Description                                                                                                | Default   | Required |
|-----------------|------------|------------------------------------------------------------------------------------------------------------|-----------|----------|
| `flush_timeout` | `duration` | Time after which a batch will be sent regardless of its size. Must be a non-zero value.                    | `"200ms"` | no       |
| `min_size`      | `number`   | The minimum size of a batch.                                                                               | `2000`    | no       |
| `max_size`      | `number`   | The maximum size of a batch, enables batch splitting.                                                      | `3000`    | no       |
| `sizer`         | `string`   | How the queue and batching is measured. Overrides the sizer set at the `sending_queue` level for batching. | `"items"` | no       |

If configured, `max_size` must be greater than or equal to `min_size`.

The `sizer` argument can be set to:

- `items`: The number of the smallest parts of each span, metric data point, or log record.
- `bytes`: the size of serialized data in bytes (the least performant option).

### resource\_attrs\_to\_s3 block

The following arguments are supported:

Expand table

| Name        | Type     | Description                                                                  | Default | Required |
|-------------|----------|------------------------------------------------------------------------------|---------|----------|
| `s3_bucket` | `string` | Configures which resource attribute’s value should be used as the S3 prefix. |         | yes      |
| `s3_prefix` | `string` | Configures which resource attribute’s value should be used as the S3 bucket. |         | no       |

When `s3_prefix` or `s3_bucket` are set, they dynamically override the \[`s3_uploader`]\[s3\_uploader] attributes. If the specified resource attribute exists in the data, its value will be used. Otherwise, the \[`s3_uploader`]\[s3\_uploader] attribute will serve as the fallback.

### Compression

- `none` (default): File compression isn’t used.
- `gzip`: Files are compressed with Gzip. **This doesn’t support `sumo_ic`marshaler.**

## 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.awss3` is only reported as unhealthy if given an invalid configuration.

## Debug information

`otelcol.exporter.awss3` doesn’t expose any component-specific debug information.

## Debug metrics

- `otelcol_exporter_queue_capacity` (gauge): Fixed capacity of the retry queue (in batches).
- `otelcol_exporter_queue_size` (gauge): Current size of the retry queue (in batches).
- `otelcol_exporter_send_failed_spans_total` (counter): Number of spans in failed attempts to send to destination.
- `otelcol_exporter_sent_spans_total` (counter): Number of spans successfully sent to destination.
- `rpc_client_duration_milliseconds` (histogram): Measures the duration of inbound RPC.
- `rpc_client_request_size_bytes` (histogram): Measures size of RPC request messages (uncompressed).
- `rpc_client_requests_per_rpc` (histogram): Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs.
- `rpc_client_response_size_bytes` (histogram): Measures size of RPC response messages (uncompressed).
- `rpc_client_responses_per_rpc` (histogram): Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs.

## Example

This example forwards scrape logs to an AWS S3 Bucket:

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

```alloy
local.file_match "logs" {
  path_targets = [{
    __address__ = "localhost",
    __path__    = "/var/log/{syslog,messages,*.log}",
    instance    = constants.hostname,
    job         = "integrations/node_exporter",
  }]
}

loki.source.file "logs" {
  targets    = local.file_match.logs.targets
  forward_to = [otelcol.receiver.loki.default.receiver]
}

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

otelcol.exporter.awss3 "logs" {
  s3_uploader {
    region = "us-east-1"
    s3_bucket = "logs_bucket"
    s3_prefix = "logs"
  }
}
```

## Compatible components

`otelcol.exporter.awss3` 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.
