Send Cloudflare logs to Better Stack using Cloudflare Logpush.
Configure Logpush job for Worker Trace Events dataset:
You will need to replace $ACCOUNT_ID and $CLOUDFLARE_TOKEN in command above. You can get your token in Cloudflare docs.
The token will need the account-level permission for Logs: Edit.
Logpush will not send any data unless logging is explicitly enabled on your Worker. Make sure to turn on logging either in your Wrangler configuration, via the API, or in the dashboard under Settings -> Observability.
See Cloudflare’s documentation for step-by-step instructions.
You should see your logs in Better Stack → Live tail.
Check out your metrics in the Cloudflare Logpush dashboard.
Cloudflare Logpush for Workers Trace Events is available on the Workers Paid plan. Logpush for other Cloudflare logs datasets are available on the Enterprise plan.
Not on a paid plan? Check out logging HTTP requests in Cloudflare via Worker.
Interested in logging other logs than Worker Trace Events from Cloudflare? Checkout the full list of available datasets in Cloudflare documentation. Specify the correct dataset in the request. Find more details in Cloudflare docs.
Please note that zone-scoped datasets (such as HTTP Requests) require a different endpoint for the POST request:
You will need to replace $ZONE_ID and $CLOUDFLARE_TOKEN in command above. You can get your token in Cloudflare docs.
The token will need the zone-level permission for Logs: Edit.
Cloudflare AI Gateway logs support Logpush too. Point it at Better Stack using the AI Gateway dataset in the Logpush job above.
The request and response bodies arrive encrypted. AI Gateway encrypts the RequestBody, ResponseBody, and Metadata fields with an RSA public key you upload to your gateway, and we can't decrypt them on ingest. They'll show up as encrypted strings.
Everything else - Model, Provider, Endpoint, StatusCode, and so on - is readable and fully searchable. You can build dashboards and alerts on top of those right away.
If you also need the prompt and response bodies, fetch them with the SQL API and decrypt on your side using your private key. The decrypted text stays on your side, not in Better Stack.
See the Cloudflare decryption guide for details.
Please let us know at hello@betterstack.com.
We're happy to help! 🙏
We use cookies to authenticate users, improve the product user experience, and for personalized ads. Learn more.