> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usequotable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloudflare Logpush

> Ship Cloudflare HTTP request logs to Agent Analytics with a Logpush HTTP destination: out of band, with every field available.

Logpush is the recommended Cloudflare connector. Cloudflare ships your HTTP request logs on its own schedule, so nothing Quotable runs is in your request path and an analytics problem can never become a website error.

## Requirements

* **Cloudflare Enterprise.** The HTTP requests dataset for Logpush is an Enterprise feature. On other plans, use the [Cloudflare Worker](https://docs.usequotable.com/agent-analytics/connectors/cloudflare-worker.md) connector.
* A Cloudflare role that can create Logpush jobs on the zone.
* The zone serves the domain the source is created for (the apex or any subdomain).

**What it measures:** every field, including response time, cache status, country and the Ray ID used for exact deduplication.

## Set up

**1. Create the source in Quotable**

In **Agent Analytics**, select **Connect source**, choose **Cloudflare Logpush** and select **Generate credentials**. Copy the token and the endpoint URL.

**2. Build the destination URL**

A Logpush HTTP destination carries headers as `header_` query parameters. Append the token as an Authorization header, with the space encoded as `%20`:

```text theme={"system"}
<your endpoint URL>?header_Authorization=Bearer%20aa_live_...
```

The token travels to Cloudflare inside the destination configuration and reaches Quotable as a normal `Authorization` header.

**3. Create the Logpush job**

In the Cloudflare dashboard, open your zone, go to **Analytics & Logs** > **Logpush** and create a job:

1. Destination: **HTTP destination**, with the URL from the previous step.
2. Dataset: **HTTP requests**.
3. Fields: select the fields below.
4. Filter: restrict the job to your hostname (see [Filter the job](#filter-the-job)).
5. Keep the default NDJSON output and gzip compression.

Cloudflare validates the destination when you save the job. The endpoint answers that check automatically.

**4. Limit the batch size**

Each delivery can carry at most 1,000 records. Set the job's maximum records per upload to `1000` (`max_upload_records` in the API) so Cloudflare never sends a larger batch.

**5. Confirm delivery**

Back in Quotable, select **Check now**. Cloudflare batches by time and size, so allow a few minutes for the first delivery.

## Fields

Select these fields from the HTTP requests dataset:

| Field | Used for | |
| - | - | - |
| `ClientRequestHost` | Domain binding | Required |
| `ClientRequestPath` or `ClientRequestURI` | Page path (the query string is always stripped) | Required |
| `ClientRequestUserAgent` | Agent detection | Required |
| `ClientIP` | Verification (used, then discarded) | Required for verification |
| `EdgeStartTimestamp` | Request time | Recommended |
| `ClientRequestMethod` | Method and intent | Recommended |
| `EdgeResponseStatus` | Errors | Recommended |
| `EdgeResponseBytes` | Response size | Recommended |
| `OriginResponseDurationMs` | Response time | Recommended |
| `CacheCacheStatus` | Cache breakdown | Recommended |
| `ClientCountry` | Country breakdown | Recommended |
| `ClientRequestReferer` | Referring host | Recommended |
| `RayID` | Exact deduplication | Recommended |

Every timestamp format Cloudflare offers is accepted (RFC 3339, Unix seconds, milliseconds, microseconds or nanoseconds). Don't add cookie, header or body fields: they're never read.

## Filter the job

Restrict the job to the domain the source was created for, so you don't ship logs that will be dropped as `host_mismatch`:

```json theme={"system"}
{
  "where": {
    "and": [
      { "key": "ClientRequestHost", "operator": "eq", "value": "example.com" }
    ]
  }
}
```

To include subdomains, combine one condition per hostname with `or`.

> [!TIP]
>
> On a busy zone, also filter on `ClientRequestUserAgent` with `contains` conditions for the agents you care about (for example `GPTBot`, `OAI-SearchBot`, `ChatGPT-User`, `ClaudeBot`, `Claude-User`, `PerplexityBot`). Human requests are dropped on arrival anyway, but filtering at Cloudflare keeps you well inside the delivery limit of 600 deliveries per 5 minutes per source.

## Create the job with the API

You can create the same job with Cloudflare's API:

```bash theme={"system"}
curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/logpush/jobs" \
  -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "quotable-agent-analytics",
    "dataset": "http_requests",
    "destination_conf": "<your endpoint URL>?header_Authorization=Bearer%20aa_live_...",
    "output_options": {
      "field_names": ["ClientRequestHost","ClientRequestPath","ClientRequestMethod","ClientRequestUserAgent","ClientIP","EdgeStartTimestamp","EdgeResponseStatus","EdgeResponseBytes","OriginResponseDurationMs","CacheCacheStatus","ClientCountry","ClientRequestReferer","RayID"],
      "timestamp_format": "rfc3339"
    },
    "filter": "{\"where\":{\"and\":[{\"key\":\"ClientRequestHost\",\"operator\":\"eq\",\"value\":\"example.com\"}]}}",
    "max_upload_records": 1000,
    "enabled": true
  }'
```

## Rotate the token

1. In Quotable, rotate the source token from **Connected sources**. The old token stops working immediately.
2. Update the job's destination URL with the new `header_Authorization` value.

Cloudflare retries failed uploads, so updating the job promptly loses no data.

## Disconnect

1. Disable or delete the Logpush job in Cloudflare, so it stops retrying.
2. Disconnect the source in Quotable. The endpoint then answers `404`. Events already accepted stay in your reports.

## Troubleshooting

| Symptom | Likely cause | Fix |
| - | - | - |
| Cloudflare won't save the destination | The token is wrong or the space isn't encoded | Use `header_Authorization=Bearer%20aa_live_…` with the current token. |
| `401` on every upload | Token rotated, or header missing | Update the destination URL with the current token. |
| `404` | Wrong source ID in the URL, or the source is disconnected | Copy the endpoint again from the source in Quotable. |
| `413` | More than 1,000 records or 5 MB per upload | Set `max_upload_records` to `1000`. |
| `429` | More than 600 uploads in 5 minutes | Filter the job more narrowly or increase the upload interval. Cloudflare retries after `Retry-After`. |
| Uploads accepted, but `not_ai_agent` is high | Normal: most traffic is human | Confirm `ClientRequestUserAgent` is selected. |
| `host_mismatch` on every record | The job covers a different hostname | Add the hostname filter, or create a source for that domain. |
| `invalid_record` on every record | `ClientRequestHost` or the path field isn't selected | Re-check the required fields. |
| Every event unverified | `ClientIP` isn't selected | Add `ClientIP` to the job. |

## Next steps

> [card] [Cloudflare Worker](https://docs.usequotable.com/agent-analytics/connectors/cloudflare-worker.md)
>
> The option for plans without Logpush.

> [card] [Read the dashboard](https://docs.usequotable.com/agent-analytics/dashboard.md)
>
> What to look at once data arrives.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.