---
title: "Cloudflare"
description: "Learn how to set up Cloudflare Workers Observability to forward logs and traces data to Sentry."
url: https://docs.sentry.io/product/drains/cloudflare/
---

# Cloudflare Workers Observability

Cloudflare Workers supports [exporting OpenTelemetry (OTEL)-compliant data](https://developers.cloudflare.com/workers/observability/exporting-opentelemetry-data/) to send logs and traces to Sentry.

* Logs: Application logs including `console.log()` output and system-generated logs
* Traces: Traces showing request flows through your Worker and connected services

## [Prerequisites](https://docs.sentry.io/product/drains/cloudflare.md#prerequisites)

Before you begin, ensure you have:

* A deployed Worker that you want to monitor
* A Sentry project you want to send data to

## [Step 1: Set up destination in the Cloudflare dashboard](https://docs.sentry.io/product/drains/cloudflare.md#step-1-set-up-destination-in-the-cloudflare-dashboard)

To set up a destination in the Cloudflare dashboard, navigate to your Cloudflare account's [Workers Observability](https://dash.cloudflare.com/?to=/:account/workers-and-pages/observability/destinations) section. Then click **Add Destination** and configure either a traces or logs destination.

### [Logs Destination](https://docs.sentry.io/product/drains/cloudflare.md#logs-destination)

To configure your logs destination, click **Add destination** and configure the following:

1. Destination Name: `sentry-logs` (or any descriptive name)
2. Destination Type: Select Logs
3. OTLP Endpoint: Your Sentry OTLP logs endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/logs`)

```bash
___OTLP_LOGS_URL___
```

4. Custom Headers: Add the Sentry authentication header:

   * Header name: `x-sentry-auth`
   * Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where `{SENTRY_PUBLIC_KEY}` is your Sentry project's public key

```bash
sentry sentry_key=___PUBLIC_KEY___
```

You can find your Sentry OTLP logs endpoint and authentication header value in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Logs Endpoint** section.

### [Traces Destination](https://docs.sentry.io/product/drains/cloudflare.md#traces-destination)

To configure your traces destination, click **Add destination** and configure the following:

1. Destination Name: `sentry-traces` (or any descriptive name)
2. Destination Type: Select Traces
3. OTLP Endpoint: Your Sentry OTLP traces endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/traces`)

```bash
___OTLP_TRACES_URL___
```

4. Custom Headers: Add the Sentry authentication header:

   * Header name: `x-sentry-auth`
   * Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where `{SENTRY_PUBLIC_KEY}` is your Sentry project's public key

```bash
sentry sentry_key=___PUBLIC_KEY___
```

You can find your Sentry OTLP traces endpoint and authentication header value in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Traces Endpoint** section.

## [Step 2: Configure your Worker](https://docs.sentry.io/product/drains/cloudflare.md#step-2-configure-your-worker)

With your destinations created in the Cloudflare dashboard, update your Worker's configuration to enable telemetry export.

`wrangler.toml`

```toml
[observability.traces]
enabled = true
# Must match the destination name in the dashboard
destinations = [ "sentry-traces" ]

[observability.logs]
enabled = true
# Must match the destination name in the dashboard
destinations = [ "sentry-logs" ]
```

After updating your configuration, deploy your Worker for the changes to take effect.
