Skip to content

Add wrangler logs command to search past logs. Let LLMs & agents read logs more easily #10046

Description

@remorses

Describe the solution

With the new observability features it should be possible to implement a command that gets the last worker logs without using tail

This would be super useful for agents to let them see the logs inside the worker after a request

The API call would look something like this

ACCOUNT_ID=$(jq -r .account_id wrangler.toml)

QUERY="fields * \
  | filter timestamp >= \"$START\" and timestamp < \"$END\" \
  | sort timestamp asc \
  | limit 1000"

wrangler api accounts/$ACCOUNT_ID/workers/observability/telemetry/query \
  --method POST \
  --body "{\"query\": \"$QUERY\"}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Feature.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions