Repository navigation
Read service logs as records, per deployment or across all deployments - #26
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
valar service logsgains structured output and deployment selection, using the log API added in platform 2.14.0.--jsonrequestsformat=jsonand prints each record as one JSON line, exactly as the server sent it:{"ts", "deployment", "stream", "line"}, plusinstance, andeventandattrsonstream: "platform"lines. Keepalive lines are dropped. Readers should ignore fields they don't know.{"line": "<text>"}, solineis the field every record has.--allreads every deployment's log in version order;--deployment Nreads one deployment's.--allcannot be combined with--deployment,--tailor--skip, since the server refuses those combinations.--timestampsprefixes each human-readable line with itsts.--timestampsis unchanged, including the exact byte-offset resume of-f.Breaking for
--jsonlog output: the per-line fieldcontentis nowline, forservice logsandbatch logs.--jsonarrived 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
--jsonor--timestampsstream 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--allin plain text, sinceoffsetcovers only one deployment's log.Tested with
make testandgo vet ./..., and against a live platform with--json,--json --all,--json --deployment N,--json -fand--timestamps.