Skip to content

Read service logs as records, per deployment or across all deployments - #26

Merged
lnsp merged 1 commit into
masterfrom
logs-records
Nov 21, 2026
Merged

lnsp merged 1 commit into
masterfrom
logs-records

Conversation

@lnsp

@lnsp lnsp commented Nov 21, 2026

Copy link
Copy Markdown
Member

valar service logs gains structured output and deployment selection, using the log API added in platform 2.14.0.

  • --json requests format=json and prints each record as one JSON line, exactly as the server sent it: {"ts", "deployment", "stream", "line"}, plus instance, and event and attrs on stream: "platform" lines. Keepalive lines are dropped. Readers should ignore fields they don't know.
  • Against an older server that answers in plain text (or in text frames when following), each line becomes {"line": "<text>"}, so line is the field every record has.
  • --all reads every deployment's log in version order; --deployment N reads one deployment's. --all cannot be combined with --deployment, --tail or --skip, since the server refuses those combinations.
  • --timestamps prefixes each human-readable line with its ts.
  • Plain-text output without --timestamps is unchanged, including the exact byte-offset resume of -f.

Breaking for --json log output: the per-line field content is now line, for service logs and batch logs. --json arrived in 4.8.0 only hours ago, so this aligns it with the platform's records before anything depends on it.

Follow limitation: records have no resume cursor yet, so a followed --json or --timestamps stream that is cut reconnects at the end of the newest log and may miss lines written while reconnecting. The same now applies to a followed --all in plain text, since offset covers only one deployment's log.

Tested with make test and go vet ./..., and against a live platform with --json, --json --all, --json --deployment N, --json -f and --timestamps.

service logs --json requests format=json and prints the platform's records unchanged, one per line; keepalives are dropped and a server that answers in plain text yields {"line": ...}. --all and --deployment pick which deployment's log to read, and --timestamps prefixes each line with its time.
@lnsp
lnsp merged commit f9d5072 into master Nov 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant