I would like to collect logs in Cloudflare R2. I tried to follow the tutorial Workers Trace Events Logpush.
I’ve created an R2 bucket “dh-log” to save to logs to.
I’ve created a Logpush job successfully:
curl -X POST ‘https://api.cloudflare.com/client/v4/accounts/###/logpush
/jobs’
-H ‘X-Auth-Key: ###’
-H ‘X-Auth-Email: [email protected]’
-H ‘Content-Type: application/json’
-d ‘{
“name”: “workers-logpush”,
“logpull_options”: “fields=Event,EventTimestampMs,Outcome,Exceptions,Logs,ScriptName”,
“destination_conf”: “r2://dh-log/{DATE}?account-id=###&access-key-id=###&secret-access-key=###”,
“dataset”: “workers_trace_events”,
“enabled”: true
}’| jq .
{
“errors”: ,
“messages”: ,
“result”: {
“id”: 265352,
“dataset”: “workers_trace_events”,
“frequency”: “high”,
“kind”: “”,
“enabled”: true,
“name”: “workers-logpush”,
“logpull_options”: “fields=Event,EventTimestampMs,Outcome,Exceptions,Logs,ScriptName”,
“destination_conf”: “r2://dh-log/{DATE}?account-id=###&access-key-id=###&secret-access-key=###”,
“last_complete”: null,
“last_error”: null,
“error_message”: null,
“time_created”: “2023-07-13T15:26:13Z”
},
“success”: true
}
I’m now stucked at the point “Enable logging on your Worker”. What should contain my worker?