> For the complete documentation index, see [llms.txt](https://docs.controltheory.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.controltheory.com/controltheory-documentation/dstl8-docs/sources/cloudflare.md).

# Cloudflare

Cloudflare Logpush batches log events to an HTTP endpoint. Dstl8 receives them as one HTTP source and figures out streams from what comes in. This page covers Workers Trace Events — logs and exceptions from your Workers.

### Prerequisites

* The `dstl8` CLI, installed and logged in. See [Dstl8 CLI](/controltheory-documentation/dstl8-docs/dstl8-cli.md) — check with `dstl8 profiles`, the active one is marked `►`.
* A Cloudflare account with Logpush. Workers Trace Events needs the **Workers Paid** plan.
* Account-level access — this dataset is account-scoped only, not per zone.

### Add a Cloudflare source

Create the source from the CLI or the web app — either way you end up with the same destination URL for the Cloudflare-side Logpush job.

#### From the CLI

**1. Run the wizard**

```bash
dstl8 sources add cloudflare
```

One prompt — the source name (default `cloudflare`). The secret's generated for you, so there's nothing to grab from Cloudflare first. `:skip` cancels.

<figure><img src="/files/sHEMXBLZXv14GgTpTsY6" alt=""><figcaption><p>dstl8 sources add cloudflare</p></figcaption></figure>

Prefer scripting it?

```bash
dstl8 sources add cloudflare --yes --name cloudflare-prod
```

Still prints the destination URL below, so it's fine for CI.

**2. Copy the destination URL**

The wizard ends with one URL — your webhook URL plus the Logpush secret as a query param:

`https://<org_id>.app.dstl8.ai/src-<id>?header_X-CF-Secret=<secret>`

That's the only thing the Cloudflare side needs. (Cloudflare turns `header_*` query params into real request headers — that's how the secret gets there without a separate field.)

> Sensitive. Don't commit it or paste it into shared docs.

> Grab it now — there's no command to print it again. If you lose it, the web app still has it.

**3. Assign the source to a workspace**

* **One workspace** (the common case): streams get assigned automatically.
* **A few workspaces**: pick from a checkbox list — `1-N:toggle a:all n:none enter:assign N q:skip`.
* **Skipped it, or used `--yes`?** Do it later:

```bash
dstl8 sources assign cloudflare-prod Default
```

<figure><img src="/files/UPh36Ls6onjyh5A5Rjn7" alt=""><figcaption><p>dstl8 sources assign cloudflare-prod Default</p></figcaption></figure>

#### From the web app

**1. Open the Add Source dialog**

From **Sources**, click **Add Source** and select **Cloudflare**.

<figure><img src="/files/cmPAXOtAS1LUHmfDWACl" alt=""><figcaption><p>Add Source → Cloudflare</p></figcaption></figure>

**2. Configure the source**

Give the source a unique name (e.g. `cloudflare-prod`) and click **Create**.

<figure><img src="/files/M2MfVj1VQOyNKFWEuu3k" alt=""><figcaption><p>Name the source</p></figcaption></figure>

**3. Copy the connection details**

Dstl8 displays the values you'll paste into Cloudflare's Logpush job:

| Field                   | Notes                                                                                   |
| ----------------------- | --------------------------------------------------------------------------------------- |
| Webhook URL             | `https://<org_id>.app.dstl8.ai/src-<id>`                                                |
| LogPush Secret          | Sent by Cloudflare in the `X-CF-Secret` header to authenticate incoming events.         |
| LogPush Destination URL | Webhook URL + `?header_X-CF-Secret=<secret>` — the one value the Cloudflare side needs. |

<figure><img src="/files/TXONcSFyvFNLhs74EIFz" alt=""><figcaption><p>Cloudflare Source Created</p></figcaption></figure>

> Sensitive. Don't commit it or paste it into shared docs.

**4. Assign the source to a workspace**

Pick the workspace that should receive this source's streams and click **Assign** (or **Skip** to assign later from the source's actions menu).

<figure><img src="/files/ndk20E9lqo8928GAnkyE" alt=""><figcaption><p>Assign the source to a workspace</p></figcaption></figure>

### Create the Logpush job in Cloudflare

With that destination URL copied:

#### 1. Open Logpush

In the left menu, go to **Observe → Investigate → Logpush**.

<figure><img src="/files/r4Jkvi6czn693oPH3eFv" alt=""><figcaption><p>Navigate to Logpush</p></figcaption></figure>

#### 2. Create a job

Click **Create a Logpush job**.

<figure><img src="/files/NfXpSy9quwPSnteRbvk6" alt=""><figcaption><p>Create a Logpush job</p></figcaption></figure>

#### 3. Pick HTTP

Select **HTTP** as the destination. Cloudflare will POST batches of log events to that endpoint on an interval instead of streaming them one by one.

<figure><img src="/files/5lke8gPipptwEe6lf7NO" alt=""><figcaption><p>Choose HTTP destination</p></figcaption></figure>

#### 4. Paste the URL

In **HTTP endpoint**, paste the destination URL you copied earlier. Don't strip the `header_X-CF-Secret` param or add others.

<figure><img src="/files/QC3ahBnZmCFBx2juxCU6" alt=""><figcaption><p>Paste the destination URL</p></figcaption></figure>

#### 5. Pick the dataset and submit

Select **Workers Trace Events**. Leave the rest at their defaults, then **Submit**.

<figure><img src="/files/89OKOyqtMNuLheW4rNPB" alt=""><figcaption><p>Select Workers Trace Events</p></figcaption></figure>

<figure><img src="/files/VL23eplxjn3mVpVvnGFj" alt=""><figcaption><p>Submit the Logpush job</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.controltheory.com/controltheory-documentation/dstl8-docs/sources/cloudflare.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
