---
title: Ingesting Cloudflare Logs and Metrics into Statsig
description: "Run Statsig server SDK evaluations inside Cloudflare Workers, including configuration, request lifecycle, and how to log exposures from the edge."
product: general
last_updated: 2025-09-18
token_estimate: 619
---
# Ingesting Cloudflare Logs and Metrics into Statsig

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## How Cloudflare Logpush integration works

This guide walks you through setting up the Cloudflare Logpush worker in your Cloudflare account and configuring it to send logs and metrics to Statsig using curl and the Logpush API.

---

## ✅ Prerequisites

- [Cloudflare Logpush enabled for your account](https://developers.cloudflare.com/logs/logpush/)
- [Statsig Server SDK Key](https://docs.statsig.com/server-core/)

---

## Configuring Logpush worker

1. [Create an API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).
2. Ensure the token has logs edit permissions at the account level.
3. [Locate your Cloudflare account ID](https://developers.cloudflare.com/fundamentals/account/find-account-and-zone-ids/).
4. Run the following command and get the job ID:

```plaintext
ACCOUNT_ID=<my account id>
CLOUDFLARE_API_TOKEN=<cloudflare token>
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/logpush/jobs" \
  --request POST \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --json '{
    "name": "statsig-logpush-job",
    "destination_conf": "https://api.statsig.com/v1/log_event/cf_log_drain?header_statsig-api-key=<statsig-secret-key>&header_Content-Type=application%2Fjson",
    "dataset": "workers_trace_events",
    "output_options": {
      "field_names": [],
      "output_type": "ndjson",
      "batch_prefix": "{\"events\":[",
      "batch_suffix": "\n]}\n",
      "record_prefix": "\n  {\"info\":{",
      "record_suffix": "}}",
      "record_delimiter": ",",
      "timestamp_format": "rfc3339"
    }
  }'
```

- In the Cloudflare dashboard, navigate to _Analytics & Logs > Logpush_ and enable the logpush job.

## Verify logs on Statsig Console

Explore your logs and metrics at [console.statsig.com](http://console.statsig.com) using the Logs Explorer and Metrics Explorer products under _Analytics_ in the sidebar.

---

## 🔗 Resources

- [Manage Logpush with cURL](https://developers.cloudflare.com/logs/logpush/examples/example-logpush-curl/)
- [Logpush output types](https://developers.cloudflare.com/logs/logpush/logpush-job/log-output-options/#output-types)
- [Create logpush API docs](https://developers.cloudflare.com/api/resources/logpush/subresources/jobs/methods/create/)

