Repository navigation
Add tail to follow a fleet's logs - #35
Closed
siliconwitch wants to merge 2 commits into
Closed
siliconwitch wants to merge 2 commits into
siliconwitch wants to merge 2 commits into
Conversation
tail takes one fleet id and optional IMEIs. It prints the newest logs, then each new one as the server's long poll returns it, and retries a dropped connection from the same cursor so no line is lost or repeated. Each line is the local time the server received the log, the device's name or IMEI, the kind in brackets, and the text. Tabs, quotes, and backslashes print as the device sent them. Other control characters are escaped so device output cannot drive the terminal.
-n has no upper limit and pages through the server's answers. Each line is time, IMEI, kind, then the name in brackets. --log-file is gone, and tail's own notices go to the error stream so the output holds only logs.
Member
Author
|
Abandoned. The transport work restarts from the rewritten design.md, and logging follows in its own cycle. The branch is kept as tail-reference. |
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.
superstack tail <fleet_id> [imei ...] [-n num] [--log-file <file>]follows one fleet's logs, or only the named devices in it.It prints the newest
numlogs, 10 unless given, then each new log as the server's long poll returns it. A request that fails to connect, times out, or gets a 5xx answer is retried from the same cursor after 1, 2, 4, then 10 seconds, so no line is lost or repeated. Any 4xx answer ends the command with the server's message.Each line is the local date and time the server received the log, the device's name or IMEI, the kind in brackets, and the text:
Tabs, quotes, and backslashes print as the device sent them, so a
printlooks as it does in desktop Lua. Other control characters and non-graphic runes are escaped, so device output cannot drive the terminal.--log-fileappends the same lines to a file.It needs the server change that adds
GET /fleets/{id}/logs. Against a server without that route,tailends with the server's message.Checks:
CGO_ENABLED=0 go build ./...,go vet ./...,go test ./..., andgofmt -l .pass, andgo mod tidychanges nothing.TestTheModuleStaysDependencyFreepasses andconst versionis unchanged. The built binary was also exercised against a local server and a test device: history, a whole fleet, named devices, a device outside the fleet, an unknown fleet, and a server stopped and restarted mid-session.