Export to PostHog
Last updated Oct 2, 2026 PostHog provides product analytics, logs, and error tracking. Export Cloudflare logs to correlate them with sessions and events.

This guide configures PostHog to receive Cloudflare logs.
Prerequisites
Before you begin, you need:
- An active PostHog account ↗︎
- Your PostHog project API key
- Cloudflare logs available for export
1. Get your PostHog project API key
- Log in to your PostHog account ↗︎.
- Go to Project settings ↗︎.
- Find Project API key in the project details.
- Copy the project API key.
The project API key starts with phc_.
2. Select your PostHog endpoint
PostHog uses different endpoints for each data region:
| Region | Logs endpoint |
|---|---|
| US (default) | https://us.i.posthog.com/i/v1/logs |
| EU | https://eu.i.posthog.com/i/v1/logs |
Find your region in your PostHog project settings. Your PostHog URL also contains us or eu.
3. Configure a Cloudflare Observability destination
Caution
PostHog accepts logs through its OpenTelemetry Protocol (OTLP) endpoint. It does not accept traces through OTLP.
- In the Cloudflare dashboard, go to Observability > Destinations. Go to OpenTelemetry ↗
- Select Add destination.
- Configure the destination:
- Destination name:
posthog-logs - Destination type: Logs
- OTLP endpoint: Your PostHog regional logs endpoint
- Custom header name:
Authorization - Custom header value:
Bearer <YOUR_PROJECT_API_KEY> - Select Save.

4. Enable export
Creating a destination does not start exporting logs. To export Workers Logs, configure OpenTelemetry export for your Worker. PostHog does not support Workers Traces or Cloudflare Traces through OTLP.
5. View logs in PostHog
- Log in to your PostHog account ↗︎.
- Go to Logs.
- Review exported severity levels, timestamps, and attributes.
You can filter logs by severity, time range, attributes, and keywords.
Troubleshooting
Logs do not appear in PostHog
- Verify that the API key starts with
phc_. - Confirm that the endpoint matches your PostHog region.
- Check the destination status in the Cloudflare dashboard.
- Check whether sampling excludes the expected logs.
Fix authentication errors
Confirm that the Authorization value includes the Bearer prefix. Also verify that the project API key remains active.
Alternatively, add the token to the endpoint query string: https://us.i.posthog.com/i/v1/logs?token=<YOUR_PROJECT_API_KEY>.
Related resources
- PostHog logs documentation ↗︎
- PostHog getting started with logs ↗︎
- OpenTelemetry logs specification ↗︎
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/observability/export/opentelemetry/posthog/#page","headline":"Export to PostHog","description":"Send Cloudflare logs to PostHog with OpenTelemetry.","url":"https://developers.cloudflare.com/observability/export/opentelemetry/posthog/","inLanguage":"en","image":"https://developers.cloudflare.com/observability/export/opentelemetry/posthog/og.png?v=b04f19c37d80595b","dateModified":"2026-10-02","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Send Cloudflare traces and logs to Sentry with OpenTelemetry. title: Export to Sentry image: https://developers.cloudflare.com/observability/export/opentelemetry/sentry/og.png?v=247022c35dd41725
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/observability/llms.txt
Use this file to discover all available pages before exploring further.
