Skip to main content
Follows a service’s logs live until you stop it with Ctrl-C.

Arguments

string
required
The ID of the service whose logs you want, for example clu_abc.

Flags

boolean
required
Stream log events until interrupted. Required: this command only streams, and there’s no one-off read.
string
Only show events at this level or above. One of debug, info, warn or error.
integer
Replay this many past lines before following, from 0 to 5000.
string
Organization the service belongs to, instead of the selected one.
boolean
default:"false"
Print newline-delimited JSON (NDJSON), one record per line. See JSON output.

Examples

Human output

Each event is printed on its own line as it arrives. Log text comes straight from the database, so the CLI cleans out terminal control characters before printing. A log line can’t repaint your terminal or fake other output. Notices, such as reconnect messages, go to stderr. Piping stdout into a file or another tool captures only log lines.

JSON output

With --json, stdout carries one JSON record per line:
The type, event and error keys are part of the CLI’s stable output. The contents of event are passed through exactly as the API sent them and are not a stable format: fields may change. Read them defensively. If an event isn’t JSON, it’s passed through as a string.
Pressing Ctrl-C isn’t an error, so it doesn’t produce an error record.

Reconnecting

If the connection drops for a reason that can be retried, the CLI reconnects on its own. This includes network failures, 429 (too many log streams open for the organization) and 503 (the log stream couldn’t attach to the database).
  • It keeps trying for as long as you let it, waiting longer between attempts each time, up to 30 seconds. --follow means follow, so an outage doesn’t quietly cut the log short.
  • It picks up where it left off, from the time of the last event it saw.
  • Events may still be missed during the gap. Each reconnect prints Reconnecting to the log stream; events may have been missed during the gap. on stderr, so you can see where a gap might be.
  • --tail applies only to the first connection. A reconnect doesn’t replay history again.
Errors that can’t be fixed by retrying, such as a revoked key or a service that doesn’t exist, end the stream with exit code 1.

Stopping

Press Ctrl-C, or send SIGTERM. The CLI closes the stream, cancels any pending reconnect and exits with code 130.

Errors