OpenClaw has two main log surfaces:Documentation Index
Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
- File logs (JSON lines) written by the Gateway.
- Console output shown in terminals and the Gateway Debug UI.
Where logs live
By default, the Gateway writes a rolling log file under:/tmp/openclaw/openclaw-YYYY-MM-DD.log
The date uses the gateway host’s local timezone.
Each file rotates when it reaches logging.maxFileBytes (default: 100 MB).
OpenClaw keeps up to five numbered archives beside the active file, such as
openclaw-YYYY-MM-DD.1.log, and keeps writing to a fresh active log instead of
suppressing diagnostics.
You can override this in ~/.openclaw/openclaw.json:
How to read logs
CLI: live tail (recommended)
Use the CLI to tail the gateway log file via RPC:--local-time: render timestamps in your local timezone--url <url>/--token <token>/--timeout <ms>: standard Gateway RPC flags--expect-final: agent-backed RPC final-response wait flag (accepted here via the shared client layer)
- TTY sessions: pretty, colorized, structured log lines.
- Non-TTY sessions: plain text.
--json: line-delimited JSON (one log event per line).--plain: force plain text in TTY sessions.--no-color: disable ANSI colors.
--url, the CLI does not auto-apply config or
environment credentials; include --token yourself if the target Gateway
requires auth.
In JSON mode, the CLI emits type-tagged objects:
meta: stream metadata (file, cursor, size)log: parsed log entrynotice: truncation / rotation hintsraw: unparsed log line
openclaw logs falls back to
the configured local log file automatically. Explicit --url targets do not
use this fallback.
If the Gateway is unreachable, the CLI prints a short hint to run:
Control UI (web)
The Control UI’s Logs tab tails the same file usinglogs.tail.
See /web/control-ui for how to open it.
Channel-only logs
To filter channel activity (WhatsApp/Telegram/etc), use:Log formats
File logs (JSONL)
Each line in the log file is a JSON object. The CLI and Control UI parse these entries to render structured output (time, level, subsystem, message). File-log JSONL records also include machine-filterable top-level fields when available:hostname: gateway host name.message: flattened log message text for full-text search.agent_id: active agent id when the log call carries agent context.session_id: active session id/key when the log call carries session context.channel: active channel when the log call carries channel context.
Console output
Console logs are TTY-aware and formatted for readability:- Subsystem prefixes (e.g.
gateway/channels/whatsapp) - Level coloring (info/warn/error)
- Optional compact or JSON mode
logging.consoleStyle.
Gateway WebSocket logs
openclaw gateway also has WebSocket protocol logging for RPC traffic:
- normal mode: only interesting results (errors, parse errors, slow calls)
--verbose: all request/response traffic--ws-log auto|compact|full: pick the verbose rendering style--compact: alias for--ws-log compact
Configuring logging
All logging configuration lives underlogging in ~/.openclaw/openclaw.json.
Log levels
logging.level: file logs (JSONL) level.logging.consoleLevel: console verbosity level.
OPENCLAW_LOG_LEVEL environment variable (e.g. OPENCLAW_LOG_LEVEL=debug). The env var takes precedence over the config file, so you can raise verbosity for a single run without editing openclaw.json. You can also pass the global CLI option --log-level <level> (for example, openclaw --log-level debug gateway run), which overrides the environment variable for that command.
--verbose only affects console output and WS log verbosity; it does not change
file log levels.
Trace correlation
File logs are JSONL. When a log call carries a valid diagnostic trace context, OpenClaw writes the trace fields as top-level JSON keys (traceId, spanId,
parentSpanId, traceFlags) so external log processors can correlate the line
with OTEL spans and provider traceparent propagation.
Gateway HTTP requests and Gateway WebSocket frames establish an internal request
trace scope. Logs and diagnostic events emitted inside that async scope inherit
the request trace when they do not pass an explicit trace context. Agent run and
model-call traces become children of the active request trace, so local logs,
diagnostic snapshots, OTEL spans, and trusted provider traceparent headers can
be joined by traceId without logging raw request or model content.
Model call size and timing
Model-call diagnostics record bounded request/response measurements without capturing raw prompt or response content:requestPayloadBytes: UTF-8 byte size of the final model request payloadresponseStreamBytes: UTF-8 byte size of streamed model response eventstimeToFirstByteMs: elapsed time before the first streamed response eventdurationMs: total model-call duration
Console styles
logging.consoleStyle:
pretty: human-friendly, colored, with timestamps.compact: tighter output (best for long sessions).json: JSON per line (for log processors).
Redaction
OpenClaw can redact sensitive tokens before they hit console output, file logs, OTLP log records, persisted session transcript text, or Control UI tool event payloads (tool start args, partial/final result payloads, derived exec output, and patch summaries):logging.redactSensitive:off|tools(default:tools)logging.redactPatterns: list of regex strings to override the default set. Custom patterns apply on top of the built-in defaults for Control UI tool payloads, so adding a pattern never weakens redaction of values already caught by the defaults.
logging.redactSensitive: "off" only disables this general log/transcript
policy. OpenClaw still redacts safety-boundary payloads that can be shown to UI
clients, support bundles, diagnostics observers, approval prompts, or agent
tools. Examples include Control UI tool-call events, sessions_history output,
diagnostics support exports, provider error observations, exec approval command
display, and Gateway WebSocket protocol logs. Custom logging.redactPatterns
can still add project-specific patterns on those surfaces.
Diagnostics and OpenTelemetry
Diagnostics are structured, machine-readable events for model runs and message-flow telemetry (webhooks, queueing, session state). They do not replace logs — they feed metrics, traces, and exporters. Events are emitted in-process whether or not you export them. Two adjacent surfaces:- OpenTelemetry export — send metrics, traces, and logs over OTLP/HTTP to any OpenTelemetry-compatible collector or backend (Grafana, Datadog, Honeycomb, New Relic, Tempo, etc.). Full configuration, signal catalog, metric/span names, env vars, and privacy model live on a dedicated page: OpenTelemetry export.
- Diagnostics flags — targeted debug-log flags that route extra logs to
logging.filewithout raisinglogging.level. Flags are case-insensitive and support wildcards (telegram.*,*). Configure underdiagnostics.flagsor via theOPENCLAW_DIAGNOSTICS=...env override. Full guide: Diagnostics flags.
Troubleshooting tips
- Gateway not reachable? Run
openclaw doctorfirst. - Logs empty? Check that the Gateway is running and writing to the file path
in
logging.file. - Need more detail? Set
logging.leveltodebugortraceand retry.
Related
- OpenTelemetry export — OTLP/HTTP export, metric/span catalog, privacy model
- Diagnostics flags — targeted debug-log flags
- Gateway logging internals — WS log styles, subsystem prefixes, and console capture
- Configuration reference — full
diagnostics.*field reference