Skip to content

Add -n/--tail support to lstk logs#359

Draft
gtsiolis wants to merge 1 commit into
mainfrom
pro-358-support-n-tail-n-in-lstk-logs
Draft

Add -n/--tail support to lstk logs#359
gtsiolis wants to merge 1 commit into
mainfrom
pro-358-support-n-tail-n-in-lstk-logs

Conversation

@gtsiolis

@gtsiolis gtsiolis commented Jul 2, 2026

Copy link
Copy Markdown
Member

Motivation

DevRel parity report: the Python CLI supports localstack logs -n 20 to inspect the last N log lines, while lstk logs only offered all-or-follow — cumbersome on a busy emulator and a migration papercut. -n, --tail (default all) is also the exact convention of docker logs, docker compose logs, and nerdctl logs.

Changes

  • Add -n, --tail to lstk logs (string, default "all", wording identical to docker logs); validated at the command boundary — non-negative integer or all
  • Thread the value through container.Logs / ui.RunLogs into runtime.StreamLogs, which previously hardcoded Tail: "all"
  • --follow --tail N shows the last N lines and then streams (handled natively by the Docker API)
  • Regenerate MockRuntime for the StreamLogs signature change

Tail applies to raw log lines before the noise filter (docker semantics), so --tail 20 can display fewer than 20 lines unless -v is passed.

Tests

  • New integration tests, red-green verified: --tail/-n limit output, default shows all lines, invalid values are rejected with a helpful error, and --follow --tail starts from the tail
  • Manually verified against a real container in both plain and TUI (PTY) modes, including --tail 0, --tail all, over-count values, and combined -fn 3

Closes PRO-358

@gtsiolis gtsiolis added semver: minor docs: needed Pull request requires documentation updates labels Jul 2, 2026
@gtsiolis gtsiolis self-assigned this Jul 2, 2026
@gtsiolis gtsiolis force-pushed the pro-358-support-n-tail-n-in-lstk-logs branch from 334bff0 to 0fe0c71 Compare July 3, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates semver: minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant