The Simplest Way to Make Cloudflare Workers and Datadog Work Like They Should
Pairing cloudflare workers and datadog lets your team track edge code speed and errors. You send worker logs and traces to central dashboards for fast alerts. Edge apps run across many global nodes at the same time. When an edge script fails, local console logs disappear right away. Your team needs a steady path to ship those events to one place. Good setup keeps your keys safe and keeps your log bills low. How cloudflare workers and datadog share logs and traces Cloudflare runs your code cl
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Pairing cloudflare workers and datadog lets your team track edge code speed and errors. You send worker logs and traces to central dashboards for fast alerts.
Edge apps run across many global nodes at the same time. When an edge script fails, local console logs disappear right away. Your team needs a steady path to ship those events to one place. Good setup keeps your keys safe and keeps your log bills low.
How cloudflare workers and datadog share logs and traces
Cloudflare runs your code close to users, while Datadog stores and graphs your logs. You link them by setting up a log push job or a tail worker. The edge platform batches events from each request and sends them over HTTPS.
Your worker script needs a write-only intake key to send data out. Store this key as an encrypted secret inside your edge project settings. Never put raw keys inside your source code files or public repos. The log push job uses this secret to prove its identity on each batch.
Data flows in one way from the edge network to the log intake endpoint. Each log event carries status codes, run times, and custom text from your script. You can also pass trace headers so edge requests link to backend database calls. This full path shows you if a slow load happens at the edge or core.
Common failure modes and how to scope roles
Many teams make the mistake of sharing one master API key across all apps. If one test worker leaks that key, attackers can flood your main log account. Fake logs can hide real attacks and drive up your monthly storage costs. Always create a separate intake key for each stage, like test and prod.
Broad team roles also cause big risks in both cloud portals. An engineer who only reads dashboards does not need rights to change worker code. Give each team member the smallest role needed to do their daily job. Use single sign-on groups to assign read or write roles in both tools.
End-to-End Encryption + Datadog Security Monitoring: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unfiltered edge logs often leak private user data into your central log storage. Request bodies and headers can hold emails, phone numbers, card numbers, or national IDs. You must set up scrubbing rules before the logs leave the edge network. Good scrubbing rules rewrite matched fields in results so sensitive strings stay safe.
How to keep edge log traffic reliable and clean
High traffic spikes at the edge can create millions of log lines per minute. Sending every single debug line will slow down your dashboards and waste money. Use sampling rules in your tail worker to drop normal traffic logs. Keep all error events and slow requests so your team can fix real bugs.
Network drops between the two platforms can also cause missing data gaps. Make sure your log export setup uses retries with short wait times. Tag every edge log with the service name, region, and git commit hash. Clear tags help on-call engineers filter noisy graphs during a live site outage.
Audit your keys and log pipelines at least once every quarter. Remove old intake keys that belong to deleted workers or past test projects. Check your dashboard audit logs to see who exports or deletes log views. Strong habits keep your edge data pipeline fast, clean, and safe.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Should I send logs straight from the main worker or use a tail worker?
Use a tail worker or built-in log push instead of direct network calls. Direct calls inside your main script add wait time for your end users. A tail worker runs after the user gets their response, keeping the app fast.
How do I stop edge logs from storing private user details?
Filter headers and payload fields inside your tail worker before sending the batch. You can also turn on intake parsing rules to scrub emails and card numbers. Both steps rewrite matched fields in results before anyone queries the dashboard.
What permissions should the Datadog key have for worker log shipping?
Use an intake API key that only has rights to write new log events. Never use a full app key that can read dashboards or change alert rules. Give each worker project its own intake key so you can rotate them fast.
Related guides
In this post