---
summary: "CLI reference for `nodmix logs` (tail gateway logs via RPC)"
read_when:
  - You need to tail Gateway logs remotely (without SSH)
  - You want JSON log lines for tooling
title: "Logs"
---

# `nodmix logs`

Tail Gateway file logs over RPC (works in remote mode).

Related:

- Logging overview: [Logging](/logging)
- Gateway CLI: [gateway](/cli/gateway)

## Options

- `--limit <n>`: maximum number of log lines to return (default `200`)
- `--max-bytes <n>`: maximum bytes to read from the log file (default `250000`)
- `--follow`: follow the log stream
- `--interval <ms>`: polling interval while following (default `1000`)
- `--json`: emit line-delimited JSON events
- `--plain`: plain text output without styled formatting
- `--no-color`: disable ANSI colors
- `--local-time`: render timestamps in your local timezone (default)
- `--utc`: render timestamps in UTC

## Shared Gateway RPC options

`nodmix logs` also accepts the standard Gateway client flags:

- `--url <url>`: Gateway WebSocket URL
- `--token <token>`: Gateway token
- `--timeout <ms>`: timeout in ms (default `30000`)
- `--expect-final`: wait for a final response when the Gateway call is agent-backed

When you pass `--url`, the CLI does not auto-apply config or environment credentials. Include `--token` explicitly if the target Gateway requires auth.

## Examples

```bash
nodmix logs
nodmix logs --follow
nodmix logs --follow --interval 2000
nodmix logs --limit 500 --max-bytes 500000
nodmix logs --json
nodmix logs --plain
nodmix logs --no-color
nodmix logs --limit 500
nodmix logs --local-time
nodmix logs --utc
nodmix logs --follow --local-time
nodmix logs --url ws://127.0.0.1:18789 --token "$NODMIX_GATEWAY_TOKEN"
```

## Notes

- Timestamps render in your local timezone by default. Use `--utc` for UTC output.
- If the implicit local loopback Gateway asks for pairing, closes during connect, or times out before `logs.tail` answers, `nodmix logs` falls back to the configured Gateway file log automatically. Explicit `--url` targets do not use this fallback.
- `nodmix logs --follow` does not follow configured-file fallbacks after implicit local Gateway RPC failures. On Linux, it uses the active user-systemd Gateway journal by PID when available and prints the selected log source; otherwise it keeps retrying the live Gateway instead of tailing a potentially stale side-by-side file.
- When using `--follow`, transient gateway disconnects (WebSocket close, timeout, connection drop) trigger automatic reconnection with exponential backoff (up to 8 retries, capped at 30 s between attempts). A warning is printed to stderr on each retry, and a `[logs] gateway reconnected` notice is printed once a poll succeeds. In `--json` mode both the retry warning and the reconnect transition are emitted as `{"type":"notice"}` records on stderr. Non-recoverable errors (auth failure, bad configuration) still exit immediately.

## Related

- [CLI reference](/cli)
- [Gateway logging](/gateway/logging)
