# Cloudflare Tail Worker Datadog

> Streams Cloudflare Worker logs to Datadog in real-time.

- **Type:** MCP server
- **Install:** `agentstack add mcp-explorium-ai-cloudflare-tail-worker-datadog`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [explorium-ai](https://agentstack.voostack.com/s/explorium-ai)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [explorium-ai](https://github.com/explorium-ai)
- **Source:** https://github.com/explorium-ai/cloudflare-tail-worker-datadog
- **Website:** https://www.explorium.ai

## Install

```sh
agentstack add mcp-explorium-ai-cloudflare-tail-worker-datadog
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Cloudflare to Datadog Tail Worker

Send your Cloudflare Worker logs to Datadog in real-time. This tail worker transforms and forwards logs with custom tags and structured format.

## Why This?

- **Datadog SDK doesn't work** in Cloudflare Workers (Node.js dependencies)
- **Logpush is bulky** - sends huge batches instead of individual logs
- **Need real-time logs** with custom enrichment and tagging

## Quick Start

1. **Clone and install**
   ```bash
   git clone https://github.com/explorium-ai/cloudflare-tail-worker-datadog.git
   cd cloudflare-tail-worker-datadog
   npm install
   ```

2. **Set your Datadog API key**
   ```bash
   wrangler secret put DD_API_KEY
   ```

3. **Configure environment** in `wrangler.jsonc`:
   ```json
   {
     "vars": {
       "SERVICE_NAME": "your-service-name",
       "ENVIRONMENT": "production",
       "DD_SITE": "datadoghq.com"
     }
   }
   ```

4. **Deploy**
   ```bash
   npm run deploy
   ```

5. **Connect your workers** - add to their `wrangler.toml`:
   ```toml
   [[tail_consumers]]
   service = "cloudflare-tail-worker-datadog"
   ```

Done! Your logs now flow to Datadog in real-time.

## Configuration

| Variable | Required | Description | Example |
|----------|----------|-------------|---------|
| `DD_API_KEY` | ✅ | Your Datadog API key | `abc123...` |
| `SERVICE_NAME` | ✅ | Service name for tagging | `my-api-service` |
| `ENVIRONMENT` | ❌ | Environment tag (defaults to `dev`) | `production` |
| `DD_SITE` | ❌ | Datadog site (defaults to `datadoghq.com`) | `datadoghq.eu` |

## How It Works

1. Receives tail events from your Workers in real-time
2. Transforms logs into structured format with tags
3. Sends to Datadog via HTTP API
4. Adds metadata: service name, environment, timestamps

## Development

```bash
npm test          # Run tests
npm run dev       # Local development  
npm run cf-typegen # Generate types
```

## Viewing Logs in Datadog

Your logs appear in Datadog with structured tags:

**Find your logs:**
- Filter by `source:cloudflare-tail-worker` 
- Use tags like `service:your-service-name` or `env:production`

**Example queries:**
```
source:cloudflare-tail-worker AND status:error
service:my-api AND env:production  
log_level:error OR log_level:warn
```

## Troubleshooting

**No logs appearing?**
- Check API key exists: `wrangler secret list`
- Verify `[[tail_consumers]]` in your worker's `wrangler.toml`
- Ensure your workers are actually logging (`console.log`)
- Confirm correct `DD_SITE` for your region

**Debug your tail worker:**
```bash
wrangler tail cloudflare-tail-worker-datadog  # Watch live logs
wrangler list                  # Check deployment
```

## License

MIT

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [explorium-ai](https://github.com/explorium-ai)
- **Source:** [explorium-ai/cloudflare-tail-worker-datadog](https://github.com/explorium-ai/cloudflare-tail-worker-datadog)
- **License:** MIT
- **Homepage:** https://www.explorium.ai

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-explorium-ai-cloudflare-tail-worker-datadog
- Seller: https://agentstack.voostack.com/s/explorium-ai
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
