
Insert your Cloudflare details
You will need to replace $ACCOUNT_ID
and $CLOUDFLARE_TOKEN
in command above. You can get your token in Cloudflare docs.
Send Cloudflare logs to Better Stack using Cloudflare Logpush.
Configure Logpush job for Worker Trace Events dataset:
curl -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/logpush/jobs" \
-H "Authorization: Bearer $CLOUDFLARE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "logpush-better-stack-logs",
"destination_conf": "https://in.logs.betterstack.com?header_Content-Type=application%2Fx-ndjson&header_Authorization=Bearer%20$SOURCE_TOKEN",
"dataset": "workers_trace_events",
"enabled": true
}'
You will need to replace $ACCOUNT_ID
and $CLOUDFLARE_TOKEN
in command above. You can get your token in Cloudflare docs.
You should see your logs in Better Stack -> Live tail.
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.
Please let us know at hello@betterstack.com.
We're happy to help! 🙏
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.