Skip to content

Workers Observability: custom console.log fields not returned in events view #342

@ocluf

Description

@ocluf

Problem

When querying Workers logs via the workers-observability MCP server's events view, custom fields from structured console.log() calls are not included in the response. The fields are indexed and work for filtering and calculations/groupBy, but their values are never returned in event results.

Example

A Worker logging:

console.log({ event: "sync_complete", userId: "abc-123", synced: 10, durationMs: 1307 })

Cloudflare Dashboard shows the full event with custom fields at the top level:

{
  "event": "sync_complete",
  "userId": "abc-123",
  "synced": 10,
  "durationMs": 1307,
  "$workers": { ... },
  "$metadata": { "type": "cf-worker", ... }
}

MCP events view returns the same event (same $metadata.id) without the custom fields:

{
  "dataset": "cloudflare-workers",
  "timestamp": 1775208144119,
  "source": {},
  "$workers": { ... },
  "$metadata": { ... }
}

What works vs what doesn't

Feature Custom fields work?
Filtering (event eq "sync_complete") Yes
observability_values (list values for event, userId) Yes
Calculations with groupBy (count by event + userId) Yes
Events view — seeing the actual field values No

Current workaround

We currently have to call the REST API directly via a custom script to bypass the MCP and get the full event payload:

const url = `https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/workers/observability/telemetry/query`;
const response = await fetch(url, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${API_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(query), // same query format as MCP
});
const data = await response.json();
const events = data.result?.events?.events; // these DO include custom fields

The API returns the custom fields correctly — it's only the MCP response that strips them.

Question

Is this intentional, or is there a recommended way to retrieve the full console.log content through the MCP server that we're missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions