Skip to content

Add tail to print and follow a fleet's logs - #36

Merged
siliconwitch merged 3 commits into
mainfrom
dev
Oct 7, 2026
Merged

siliconwitch merged 3 commits into
mainfrom
dev

Conversation

@siliconwitch

@siliconwitch siliconwitch commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

tail <fleet_id> [imei ...] [-n num [-o num]] reads a fleet's logs from GET /fleets/{id}/logs.

  • Without -n, it prints the newest 100 logs, then follows the fleet until Ctrl-C. A request that fails because the network or the server is unavailable is retried from the same cursor after one second.
  • -n prints a window of past logs and exits. It is 1 to 1,000 and is one request with last, so it never waits and never pages.
  • -o sits the window back by that many of the newest logs, 1 or more, and needs -n. It sends offset with last.

Each log prints as <local time with offset> <IMEI> <kind> [<name>] <text>. Later lines of a text are indented by the width of the fields, so the text forms one column. Tabs, newlines and printable characters print as they are, and every other character is escaped.

CGO_ENABLED=0 go build, go vet, gofmt -l, go mod tidy and go test ./... pass. Tests cover the argument refusals, windows with and without -o including the largest window over 2,500 stored logs, the printed layout of a multi-line log, and a follow that prints the newest 100, retries a 503 from the same cursor, and ends on the server's refusal. The binary at c161b08 ran against the server route in superstack-server ed8e54d. The binary at a891f96 has not run against a server.

tail takes a fleet id and optional IMEIs. Without -n it follows new logs.
-n prints the newest logs, and --offset skips that many of the newest
first so a tool can page back.
Plain tail prints the newest 100 logs before following, and retries from the same cursor while the server is unavailable. -o replaces --offset and sends offset with last, so a window never pages. Later lines of a log are indented under the first.
@siliconwitch
siliconwitch merged commit 218f3e7 into main Oct 7, 2026
2 checks passed
@siliconwitch
siliconwitch deleted the dev branch October 7, 2026 13:19
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