hack.foo
Native backend (beta)

Follow native service logs (under verification)

Native live logs, part of the native preview, are under verification: real-VM acceptance for authored and adopted projects is still pending. Use a disposable project. This page describes the command contract, not a confirmed application result.

Start the project and wait for the service to be ready, then select one service:

hack logs api --follow --tail 50 --path /absolute/project
hack logs api --follow --since 10m --json --path /absolute/project

Replace api with a declared service, or leave the service out to follow every service that has a container, as on Compose: each line is prefixed with its service (api | …), and JSON events already name theirs. One service's follower ending or failing does not stop the others; Ctrl-C stops them all. hack logs --no-follow without a service prints each service's bounded snapshot the same way, and its JSON is one object with a services array (and skipped for services with no container). Follow is the default. --tail accepts 0–1000 lines (default 200); --tail 0 reads only new lines. --since accepts a timestamp or duration. Its time window is still limited by the selected tail. For a finite snapshot, use --no-follow instead.

Plain output preserves stdout/stderr. JSON uses start, log and end events with backend: "native". The follower pins one saved container and start generation; it does not switch to a replacement after restart.

ResultMeaning
Ctrl-C, exit 130Stops the reader only; the project keeps running.
Stream EOF with a confirmed stop/removal, exit 0The selected service's read has ended.
native_log_stopped_idle, exit 1The stopped service's stream stayed open for five idle seconds; its final tail may be incomplete.
native_log_stream_uncertainTransport ended without proof of a confirmed service stop.
native_log_container_restartedA different start generation was observed; start a new follower.
native_log_selection_changedThe saved selection or readiness changed; it does not wait for startup.
native_log_tty_unsupportedFollowing a TTY-configured service is refused.
Output pipe closes, exit 0Stops the reader quietly, for example when piping to head -1.

The reader holds no mutation lease and does not reserve the lifecycle lock against up, down or restart. No stream result grants cleanup authority. --services, Loki queries, --until, profiles and unsupported flags are refused by name. Lines above 64 Ki characters retain a prefix marked [truncated]; a trailing fragment is marked [partial]. JSON also carries truncated: true or partial: true.

Read the limits and the full log contract before scripting exit handling or JSON. Linux stand-in tests cover framing and cancellation; actual Engine EOF and provider behavior still need Apple Silicon acceptance.


Source: v5.0.0-next.16 under verification · docs/reference/native-authored-commands.md.