CoderClaw (built on CoderClaw) logs in two places:
This page explains where logs live, how to read them, and how to configure log levels and formats.
By default, the Gateway writes a rolling log file under:
/tmp/coderclaw/coderclaw-YYYY-MM-DD.log
The date uses the gateway host’s local timezone.
You can override this in ~/.coderclaw/coderclaw.json:
{
"logging": {
"file": "/path/to/coderclaw.log"
}
}
Use the CLI to tail the gateway log file via RPC:
coderclaw logs --follow
Output modes:
--json: line-delimited JSON (one log event per line).--plain: force plain text in TTY sessions.--no-color: disable ANSI colors.In JSON mode, the CLI emits type-tagged objects:
meta: stream metadata (file, cursor, size)log: parsed log entrynotice: truncation / rotation hintsraw: unparsed log lineIf the Gateway is unreachable, the CLI prints a short hint to run:
coderclaw doctor
The Control UI’s Logs tab tails the same file using logs.tail.
See /web/control-ui for how to open it.
To filter channel activity (WhatsApp/Telegram/etc), use:
coderclaw channels logs --channel whatsapp
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).
Console logs are TTY-aware and formatted for readability:
gateway/channels/whatsapp)Console formatting is controlled by logging.consoleStyle.
All logging configuration lives under logging in ~/.coderclaw/coderclaw.json.
{
"logging": {
"level": "info",
"file": "/tmp/coderclaw/coderclaw-YYYY-MM-DD.log",
"consoleLevel": "info",
"consoleStyle": "pretty",
"redactSensitive": "tools",
"redactPatterns": ["sk-.*"]
}
}
logging.level: file logs (JSONL) level.logging.consoleLevel: console verbosity level.--verbose only affects console output; it does not change file log levels.
logging.consoleStyle:
pretty: human-friendly, colored, with timestamps.compact: tighter output (best for long sessions).json: JSON per line (for log processors).Tool summaries can redact sensitive tokens before they hit the console:
logging.redactSensitive: off |
tools (default: tools) |
logging.redactPatterns: list of regex strings to override the default setRedaction affects console output only and does not alter file logs.
Diagnostics are structured, machine-readable events for model runs and message-flow telemetry (webhooks, queueing, session state). They do not replace logs; they exist to feed metrics, traces, and other exporters.
Diagnostics events are emitted in-process, but exporters only attach when diagnostics + the exporter plugin are enabled.
diagnostics.otel.logs is enabled. Log
volume can be high; keep logging.level and exporter filters in mind.Model usage:
model.usage: tokens, cost, duration, context, provider/model/channel, session ids.Message flow:
webhook.received: webhook ingress per channel.webhook.processed: webhook handled + duration.webhook.error: webhook handler errors.message.queued: message enqueued for processing.message.processed: outcome + duration + optional error.Queue + session:
queue.lane.enqueue: command queue lane enqueue + depth.queue.lane.dequeue: command queue lane dequeue + wait time.session.state: session state transition + reason.session.stuck: session stuck warning + age.run.attempt: run retry/attempt metadata.diagnostic.heartbeat: aggregate counters (webhooks/queue/session).Use this if you want diagnostics events available to plugins or custom sinks:
{
"diagnostics": {
"enabled": true
}
}
Use flags to turn on extra, targeted debug logs without raising logging.level.
Flags are case-insensitive and support wildcards (e.g. telegram.* or *).
{
"diagnostics": {
"flags": ["telegram.http"]
}
}
Env override (one-off):
CODERCLAW_DIAGNOSTICS=telegram.http,telegram.payload
Notes:
logging.file).logging.redactSensitive.Diagnostics can be exported via the diagnostics-otel plugin (OTLP/HTTP). This
works with any OpenTelemetry collector/backend that accepts OTLP/HTTP.
{
"plugins": {
"allow": ["diagnostics-otel"],
"entries": {
"diagnostics-otel": {
"enabled": true
}
}
},
"diagnostics": {
"enabled": true,
"otel": {
"enabled": true,
"endpoint": "http://otel-collector:4318",
"protocol": "http/protobuf",
"serviceName": "coderclaw-gateway",
"traces": true,
"metrics": true,
"logs": true,
"sampleRate": 0.2,
"flushIntervalMs": 60000
}
}
}
Notes:
coderclaw plugins enable diagnostics-otel.protocol currently supports http/protobuf only. grpc is ignored.traces / metrics (default: on). Traces
include model usage spans plus webhook/message processing spans when enabled.headers when your collector requires auth.OTEL_EXPORTER_OTLP_ENDPOINT,
OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_PROTOCOL.Model usage:
coderclaw.tokens (counter, attrs: coderclaw.token, coderclaw.channel,
coderclaw.provider, coderclaw.model)coderclaw.cost.usd (counter, attrs: coderclaw.channel, coderclaw.provider,
coderclaw.model)coderclaw.run.duration_ms (histogram, attrs: coderclaw.channel,
coderclaw.provider, coderclaw.model)coderclaw.context.tokens (histogram, attrs: coderclaw.context,
coderclaw.channel, coderclaw.provider, coderclaw.model)Message flow:
coderclaw.webhook.received (counter, attrs: coderclaw.channel,
coderclaw.webhook)coderclaw.webhook.error (counter, attrs: coderclaw.channel,
coderclaw.webhook)coderclaw.webhook.duration_ms (histogram, attrs: coderclaw.channel,
coderclaw.webhook)coderclaw.message.queued (counter, attrs: coderclaw.channel,
coderclaw.source)coderclaw.message.processed (counter, attrs: coderclaw.channel,
coderclaw.outcome)coderclaw.message.duration_ms (histogram, attrs: coderclaw.channel,
coderclaw.outcome)Queues + sessions:
coderclaw.queue.lane.enqueue (counter, attrs: coderclaw.lane)coderclaw.queue.lane.dequeue (counter, attrs: coderclaw.lane)coderclaw.queue.depth (histogram, attrs: coderclaw.lane or
coderclaw.channel=heartbeat)coderclaw.queue.wait_ms (histogram, attrs: coderclaw.lane)coderclaw.session.state (counter, attrs: coderclaw.state, coderclaw.reason)coderclaw.session.stuck (counter, attrs: coderclaw.state)coderclaw.session.stuck_age_ms (histogram, attrs: coderclaw.state)coderclaw.run.attempt (counter, attrs: coderclaw.attempt)coderclaw.model.usage
coderclaw.channel, coderclaw.provider, coderclaw.modelcoderclaw.sessionKey, coderclaw.sessionIdcoderclaw.tokens.* (input/output/cache_read/cache_write/total)coderclaw.webhook.processed
coderclaw.channel, coderclaw.webhook, coderclaw.chatIdcoderclaw.webhook.error
coderclaw.channel, coderclaw.webhook, coderclaw.chatId,
coderclaw.errorcoderclaw.message.processed
coderclaw.channel, coderclaw.outcome, coderclaw.chatId,
coderclaw.messageId, coderclaw.sessionKey, coderclaw.sessionId,
coderclaw.reasoncoderclaw.session.stuck
coderclaw.state, coderclaw.ageMs, coderclaw.queueDepth,
coderclaw.sessionKey, coderclaw.sessionIddiagnostics.otel.sampleRate (0.0–1.0, root spans only).diagnostics.otel.flushIntervalMs (min 1000ms).diagnostics.otel.endpoint or
OTEL_EXPORTER_OTLP_ENDPOINT./v1/traces or /v1/metrics, it is used as-is./v1/logs, it is used as-is for logs.diagnostics.otel.logs enables OTLP log export for the main logger output.logging.file.logging.level (file log level). Console redaction does not apply
to OTLP logs.coderclaw doctor first.logging.file.logging.level to debug or trace and retry.