logs command#
Description#
The logs command shows the log of a lab node. With Docker and Podman it is the node container's log, with the c9s runtime the log of the node's primary device container in its pod.
All command line arguments can be also provided via environment variables (CLI flags take precedence). The environment variable names are constructed by prepending
CLAB_to the flag name, then adding the command path and ending with the flag name in its full form, all in uppercase and with hyphens replaced by underscores.For example, the
--max-workersflag for thedeploycommand can be set viaCLAB_DEPLOY_MAX_WORKERSenvironment variable. OrCLAB_INSPECT_ALL=1to set--allflag for theinspectcommand. OrCLAB_TOPO=srlinux.dev/clab-srl clab dep -cto deploy a lab with the topology passed via environment variable.
Usage#
containerlab [global-flags] logs [local-flags]
Flags#
topology | name#
Use the global --topo | -t flag to reference the lab topology file, or use the global --name flag to reference an already deployed lab by name. Without either, containerlab looks for a *.clab.yml file in the current directory, like the other lab commands.
node#
Use the local --node | -n flag to select the node. The flag is required. With the c9s runtime the node name is accepted as the topology file spells it or as it was sanitized for Kubernetes (R1 or r1).
tail#
The local --tail flag limits the output to the last N lines of the log. The default -1 shows the whole log; --tail 0 shows no previous lines, which is useful with --follow.
follow#
The local --follow | -f flag keeps streaming new log lines until the command is interrupted.
timestamps#
The local --timestamps flag prefixes every line with its timestamp in RFC 3339 format.
Output#
The log goes to stdout. With Docker and Podman, the container's stderr goes to stderr, unless the container has a TTY; Kubernetes returns one combined stream, written to stdout.