Skip to content

Add wrangler logs command to search past logs #10046

@remorses

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

    enhancementNew feature or request

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions