Skip to main content
Stream real-time logs from a deployed Worker.
wrangler tail [worker] [options]

Arguments

worker
string
Name or route of the worker to tail

Options

Display Options

--format
string
The format of log entriesChoices: json, prettyDefault: pretty (if terminal supports TTY), json otherwise

Filter Options

--status
string[]
Filter by invocation statusChoices: ok, error, canceled
--header
string
Filter by HTTP header
--method
string[]
Filter by HTTP method
--sampling-rate
number
Adds a percentage of requests to log sampling rate
Filter by a text match in console.log messages
--ip
string[]
Filter by the IP address the request originates from. Use “self” to filter for your own IP
--version-id
string
Filter by Worker version
--debug
boolean
If a log would have been filtered out, send it through anyway alongside the filter which would have blocked itDefault: false

Examples

Tail a Worker by name

wrangler tail my-worker

Tail a Worker by route

wrangler tail example.com/api/*

Filter by status

wrangler tail my-worker --status error

Filter by HTTP method

wrangler tail my-worker --method POST --method PUT

Filter by search term

wrangler tail my-worker --search "authentication failed"

Output as JSON

wrangler tail my-worker --format json

Filter by your own IP

wrangler tail my-worker --ip self

Sample 10% of requests

wrangler tail my-worker --sampling-rate 0.1

Filter by specific header

wrangler tail my-worker --header "X-Custom-Header: value"

Filter by Worker version

wrangler tail my-worker --version-id abc123

Output Formats

Pretty Format (default for TTY)

Human-readable output with colors and formatting:
[2026-03-03 10:30:45] GET https://example.com/api/users
  Status: 200 OK
  Duration: 42ms
  [log] Fetching users from database
  [log] Returned 150 users

JSON Format

Machine-readable JSON output, one event per line:
{"event":{"request":{"url":"https://example.com/api/users","method":"GET"},"response":{"status":200},"logs":[{"message":["Fetching users from database"],"level":"log","timestamp":1709463045000}]}}

Filtering

Status Filtering

Filter by request outcome:
# Show only errors
wrangler tail my-worker --status error

# Show successful and canceled requests
wrangler tail my-worker --status ok --status canceled

Method Filtering

Filter by HTTP method:
# Show only POST requests
wrangler tail my-worker --method POST

# Show POST and DELETE requests
wrangler tail my-worker --method POST --method DELETE

Search Filtering

Filter by text in console.log messages:
wrangler tail my-worker --search "database error"

IP Filtering

Filter by client IP address:
# Filter by specific IP
wrangler tail my-worker --ip 203.0.113.42

# Filter by your own IP
wrangler tail my-worker --ip self

# Filter by multiple IPs
wrangler tail my-worker --ip 203.0.113.42 --ip 198.51.100.1

Sampling

Reduce log volume by sampling:
# Log 10% of requests
wrangler tail my-worker --sampling-rate 0.1

# Log 50% of requests
wrangler tail my-worker --sampling-rate 0.5

Worker Identification

By Name

Tail a Worker by its name:
wrangler tail my-worker

By Route

Tail a Worker by its route (must contain a dot):
wrangler tail api.example.com/*
Wrangler automatically determines if the argument is a route (contains .) or a worker name.

Connection Management

The tail session maintains a WebSocket connection to Cloudflare’s logging service. Wrangler automatically:
  • Pings the connection every 10 seconds to detect disconnections
  • Exits gracefully when the connection is lost
  • Cleans up the tail on exit
Press Ctrl+C to stop tailing and close the connection.

Build docs developers (and LLMs) love