Skip to content
kix /docs
Install the CLI

Reference CLI

logs

Stream logs from a package's primary workload by running `kubectl logs` with the workload's label selector.

kix logs builds the cluster, finds the named package’s primary workload, and replaces itself with kubectl logs for every pod that workload selects. It saves looking up the namespace and label selector by hand. kubectl must be on PATH.

This page is hand-maintained. Check cli/kix-cli/src/cli.rs, cli/kix-cli/src/commands/logs.rs and cli/kix-cli/src/commands/workload.rs when in doubt.

kix logs <CLUSTER> <PACKAGE> [-f] [--tail <N>] [-c <CONTAINER>]
[--since <DURATION>] [-p] [--context <CONTEXT>] [--flake <FLAKE>]
Argument or flagMeaning
<CLUSTER>Cluster name to build from the flake.
<PACKAGE>Package instance name, such as vaultwarden. Use <namespace>/<name> when the instance name appears in more than one namespace.
-f, --followStream new lines (kubectl logs -f).
--tail <N>Show only the last N lines of each container (kubectl logs --tail). Unset shows everything kubectl returns by default.
-c, --container <NAME>Show one container. Without it, every container is shown.
--since <DURATION>Only lines newer than a relative duration, such as 5m, 2h, or 1h30m.
-p, --previousLogs from the previous terminated container (kubectl logs --previous).
--context <CONTEXT>Kubeconfig context, passed through to kubectl.

-q suppresses the line naming the workload and selector. See Global flags for --flake and --override-input.

The primary workload is the first Deployment in the package’s resources, then the first StatefulSet, then the first DaemonSet. A package with none of these is an error. Kix passes the workload’s spec.selector.matchLabels to kubectl logs -l, together with --all-containers=true, --prefix=true, and --max-log-requests 20, so every replica’s output appears with a pod and container prefix.

❱ kix logs demo web -f
❱ kix logs demo production/web --since 10m -c app

On success kix logs is replaced by kubectl, so the exit status is kubectl’s. A build or package-resolution failure, or a missing kubectl, exits 1.