Skip to main content

openclaw logs

View and follow OpenClaw Gateway logs in real-time.

Usage

Options

--limit <n>
number
Maximum lines to return per fetch (default: 200)
--max-bytes <n>
number
Maximum bytes to read per fetch (default: 250000)
--follow
boolean
Follow log output continuously (like tail -f)
--interval <ms>
number
Polling interval in milliseconds when following (default: 1000)
--json
boolean
Output structured JSON log lines
--plain
boolean
Plain text output without ANSI styling
--no-color
boolean
Disable ANSI colors
--local-time
boolean
Display timestamps in local timezone instead of UTC
--url <url>
string
Gateway WebSocket URL (overrides config)
--token <token>
string
Gateway authentication token
--timeout <ms>
number
RPC timeout in milliseconds

Examples

Log Format

Pretty Format (Default)

When connected to a TTY, logs are formatted for readability:
Format: TIME LEVEL MODULE MESSAGE

Plain Format

With --plain or when piped:

JSON Format

With --json:

Log Levels

Logs are categorized by severity:
  • trace: Detailed debug information
  • debug: Debug messages
  • info: Informational messages (default)
  • warn: Warning messages
  • error: Error messages
  • fatal: Fatal errors

Level Colors

In pretty mode, levels are color-coded:
  • error/fatal: Red
  • warn: Yellow
  • info: Cyan
  • debug/trace: Gray

Following Logs

Use --follow to continuously monitor logs:
This behaves like tail -f, polling the gateway every second (configurable with --interval). To stop following, press Ctrl+C.

Remote Gateway

To view logs from a remote gateway:

Log Rotation

The gateway rotates log files automatically:
  • Maximum file size: 10 MB
  • Keeps 5 rotated files
  • Rotated files: gateway.log.1, gateway.log.2, etc.
When rotation occurs, the logs command:
  1. Detects the rotation
  2. Resets the cursor
  3. Continues from the new file

Structured Logging

Logs include structured metadata:
Use --json to process structured logs with tools like jq:

Performance

The logs command:
  • Fetches logs via Gateway RPC (requires running gateway)
  • Uses cursor-based pagination for efficiency
  • Streams output to avoid buffering
  • Handles backpressure from slow terminals

Limits

  • —limit: Controls lines per fetch (affects latency)
  • —max-bytes: Prevents excessive memory usage
  • —interval: Controls polling frequency when following
For high-throughput scenarios:

Troubleshooting

Gateway Not Reachable

If logs fail to connect:
  1. Check gateway status:
  2. Verify gateway is running:
  3. Check authentication:
  4. Run diagnostics:

Log Truncation

If you see “Log tail truncated”:

Broken Pipe

If piping to a command that exits early (like head):
This is expected behavior when the pipe consumer closes.

Alternative Log Access

Direct File Access

Logs are stored in:
You can read them directly:

Platform-Specific Logs

macOS (Unified Logs)

Linux (systemd Journal)

Channel-Specific Logs

For channel-specific logs: