This Worker provides a Logpush destination that transforms Workers Trace Events into the OpenTelemetry Protocol (OTLP) format. This enables integration with existing observability systems that support OTLP.
Your destination must be OTLP compliant. If you are using a custom OpenTelemetry Collector, you can use the OTLP Receiver to ingest logs.
-
Copy Environment Variables: Duplicate the
dev.vars.samplefile and rename it to.dev.vars. -
Populate Variables: Edit
.dev.varswith the following:- An OTLP compliant destination URL.
- Any headers required by the upstream OTLP destination.
- An optional
AUTHORIZATIONheader to secure your Worker endpoint. Only requests with this header will be processed.
# If present, any request to transform logs will require this # as the authorization header AUTHORIZATION=some-secret-value # Where OTLP logs are exported to DESTINATION=http://otlp.logging.com/ # Any aditional headers you want to send to your OTLP destination can be via # DESTINATION_HEADER_(header_name)=value DESTINATION_HEADER_Authorization=otlp-authorization
-
Deploy Secrets and Worker:
pnpm wrangler secret bulk .dev.vars pnpm run deploy
After deployment, you can find your Worker in the Cloudflare dashboard under Workers & Pages. Note the Worker's URL (e.g., https://workers-logpush-otlp-transformer.example-corp.workers.dev/). This URL will be used when creating the Logpush job.
To create a Logpush job that sends logs to your deployed Worker visit the Create Logpush Job page and select the HTTP Destination destination type. You'll be prompted for the destination you'd like to send your logs to, enter the Worker's deployment URL you noted down earlier.
If you configured an AUTHORIZATION secret in your Worker's .dev.vars file, you must include this as a header in the Logpush job. Add it as a URL parameter to your destination URL. For example: https://workers-logpush-otlp-transformer.example-corp.workers.dev?header_Authorization=some-secret-value.
Choose the Workers Trace Events dataset.
Apply any necessary filters and select the fields from the Workers Trace Events dataset that you want to ingest. Refer to the Workers Trace Events dataset documentation for more information on available fields.
After creating the job, go to the Logpush Jobs page. Your new job should be listed with a status of Pushing.
By default, individual Workers do not send their logs to Logpush, you must explicitly enable Logpush for each Worker you want to monitor. For instructions on how to do this, refer to the Enable logging on your Worker section of the Cloudflare Workers documentation.
