All-in-one serverless logs API built on Cloudflare edge network.
Universal logs and analytics router compatible with multiple data sources (Claude Code, Google Analytics, Sentry, Logtail, custom apps) sending to Cloudflare Analytics Engine for unified storage and analysis.
π Live: logs.duyet.net
# Claude Code
curl -X POST https://logs.duyet.net/cc/myproject \
-H "Content-Type: application/json" \
-d '{"session_id": "abc", "metric_name": "claude_code.token.usage", "value": 1000}'
# Google Analytics
curl -X POST https://logs.duyet.net/ga/myproject \
-H "Content-Type: application/json" \
-d '{"client_id": "123", "events": [{"name": "page_view"}]}'VS Code settings.json (with project ID):
{
"claude-code.env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://logs.duyet.net/cc/myproject",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "https://logs.duyet.net/cc/myproject",
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/json"
}
}Or ~/.claude/settings.json (with project ID):
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://logs.duyet.net/cc/myproject",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "https://logs.duyet.net/cc/myproject",
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/json"
}
}Quick Start (no project ID, uses "default"):
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://logs.duyet.net/cc",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json"
}
}That's it! Projects are auto-created on first use.
- π Serverless - Zero infrastructure, runs on Cloudflare edge
- β‘ Fast - <100ms p95 response time, 300+ global locations
- π― Simple - Just POST your logs, no setup required
- π·οΈ Organized - Auto-create projects via URL path
- π Scalable - 1M writes/day free tier
- π Type-safe - 100% TypeScript, full validation
| Endpoint | Methods | Purpose | Dataset | Project ID |
|---|---|---|---|---|
/cc/:project_id |
GET, POST | Claude Code telemetry (all formats) | CLAUDE_CODE_ANALYTICS | From URL |
/cc/:project_id/v1/logs |
POST | OTLP logs (recommended) | CLAUDE_CODE_LOGS | From URL |
/cc/:project_id/v1/metrics |
POST | OTLP metrics (recommended) | CLAUDE_CODE_METRICS | From URL |
/cc/v1/logs |
POST | OTLP logs (default project) | CLAUDE_CODE_LOGS | "default" (auto) |
/cc/v1/metrics |
POST | OTLP metrics (default project) | CLAUDE_CODE_METRICS | "default" (auto) |
/ga/:project_id |
GET, POST | Google Analytics events | GA_ANALYTICS | From URL |
/logtail/:project_id |
GET, POST | Logtail/Better Stack compatible logs | LOGTAIL_ANALYTICS | From URL |
/sentry/:project_id |
GET, POST | Sentry error tracking events | SENTRY_ANALYTICS | From URL |
/realtime/:project_id |
POST | Real-time website visitor tracking | REALTIME_ANALYTICS | From URL |
| Endpoint | Method | Purpose | Parameters |
|---|---|---|---|
/api/analytics/insights |
GET | Query analytics data and generate insights | dataset, project_id, start, end, limit |
/api/analytics/datasets |
GET | List available Analytics Engine datasets | None |
| Endpoint | Method | Purpose | Response |
|---|---|---|---|
/realtime/:project_id/stats |
GET | Get 5-minute window statistics | Live visitor count, browsers, OS, devices |
/realtime/:project_id/data |
GET | Get full aggregated data with event list | Complete analytics data with event details |
| Endpoint | Method | Purpose | Request Body |
|---|---|---|---|
/api/project |
POST | Create new project | {"description": "Project description"} |
/api/project |
GET | List all projects | Query: limit, offset |
/api/project/:id |
GET | Get specific project details | None |
| Endpoint | Method | Purpose |
|---|---|---|
/ping |
GET | Health check endpoint |
/ |
GET | API info and available endpoints |
Claude Code (OTLP) - Recommended
With project ID (~/.claude/settings.json):
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://logs.duyet.net/cc/myproject",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json"
}
}Quick start (uses "default" project):
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://logs.duyet.net/cc",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json"
}
}Google Analytics (GA4)
curl -X POST https://logs.duyet.net/ga/myproject \
-H "Content-Type: application/json" \
-d '{
"client_id": "123.456",
"events": [{"name": "page_view", "params": {"page_title": "Home"}}]
}'Logtail/Better Stack
curl -X POST https://logs.duyet.net/logtail/myproject \
-H "Content-Type: application/json" \
-d '{
"message": "Application started",
"level": "info",
"dt": "2024-01-01T00:00:00.000Z"
}'Sentry Error Tracking
curl -X POST https://logs.duyet.net/sentry/myproject \
-H "Content-Type: application/json" \
-d '{
"event_id": "fc6d8c0c43fc4630ad850ee518f1b9d0",
"timestamp": "2024-01-01T12:00:00Z",
"platform": "javascript",
"level": "error",
"exception": {
"values": [{
"type": "ReferenceError",
"value": "foo is not defined",
"stacktrace": {
"frames": [{
"filename": "app.js",
"function": "handleClick",
"lineno": 42,
"colno": 10
}]
}
}]
},
"user": {
"id": "user-123",
"email": "user@example.com"
},
"tags": {
"environment": "production"
}
}'Real-time Analytics
Track event:
curl -X POST https://logs.duyet.net/realtime/myproject \
-H "Content-Type: application/json" \
-d '{
"event_type": "pageview",
"url": "https://example.com/page",
"user_agent": "Mozilla/5.0..."
}'Get live stats:
curl https://logs.duyet.net/realtime/myproject/statsProjects can be specified in multiple ways (priority order):
- URL path:
/cc/myprojector/cc/myproject/v1/logs⨠Recommended - Header:
-H "X-Project-ID: myproject" - Query parameter:
?project_id=myproject - Request body:
{"project_id": "myproject", ...} - Auto-default: Endpoints like
/cc/v1/logsautomatically use"default"project
Auto-creation: Projects are automatically created on first use with format validation (3-32 chars, lowercase alphanumeric + hyphens).
- Cloudflare Pages - Edge deployment
- Cloudflare Analytics Engine - Time-series storage (1M writes/day free)
- Cloudflare D1 - Project metadata (5GB free)
- Hono - Ultra-fast web framework
- TypeScript - Type-safe with 100% test coverage
npm install # Install dependencies
npm run dev # Local dev server (http://localhost:8788)
npm test # Run tests (167 tests, 100% coverage)
npm run build # Build for production
npm run deploy # Deploy to Cloudflare PagesSee CLAUDE.md for detailed documentation.
- π Production: https://logs.duyet.net
- π Documentation: CLAUDE.md
- π§ Hono: https://hono.dev
- βοΈ Cloudflare: https://pages.cloudflare.com
MIT