logs prints logs for an instance and its workload to the standard output. It
also allows to print real-time logs or logs for the specific period.
Note: Printing logs is only supported for Kubernetes instances.
Usage
Example
The following example shows how to print logs forkube-system Kubernetes
namespace:
1
Create an ephemeral instance
Create an ephemeral instance and note its ID:
Output
2
Print Kubernetes logs
Print logs for the
kube-system Kubernetes namespace:3
Stream Kubernetes logs
Stream logs for the
kube-system Kubernetes namespace:Options
—namespace, -n <namespace>
If providednsc prints logs only for the specified Kubernetes namespace.
—pod, -p <pod>
If providednsc prints logs only for the specified Kubernetes pod. If there
are multiple pods are running with the same name (e.g. in different Kubernetes
namespaces) logs of all pods would be printed. Use in combination with -n flag
to print the logs for the specific pod.
—container, -c <container>
If providednsc prints logs only for the specified container in a Kubernetes
pod. If there are multiple containers with the same name (e.g. running in
different Kubernetes pods and/or namespaces) logs of all containers would be
printed. Use in combination with -n and/or -p flag to print the logs for
the specific container.
—kind, -k <kind>
If specified,nsc only prints logs of the given kinds, e.g. kubernetes,
containers, system, or applications. The flag can be repeated
(-k kubernetes -k system) or given a comma-separated list
(-k kubernetes,system) to select more than one kind.
—match_message_regex <regex>
If specified,nsc only prints log lines whose message matches this regular
expression.
—since <duration>
To show logs relative to a timestamp (e.g. 42m for 42 minutes). The flag can’t be used with-f.
—after <timestamp>
Only show logs recorded after this timestamp, formatted as RFC3339 (e.g.2024-01-15T10:30:00Z). Combine with --all to query logs across all of your
instances rather than a single one.
—before <timestamp>
Only show logs recorded before this timestamp, formatted as RFC3339 (e.g.2024-01-15T12:00:00Z). Combine with --all to query logs across all of your
instances rather than a single one.
—limit <count>
The maximum number of log lines to return. Defaults to1000.
—follow, -f
If specified logs would be streamed continuously starting from now.—raw
Can be specified to print raw logs - e.g. without namespace/pod/container labels.—output, -o <plain|json>
Specifies the output format. Supported values areplain and json; json
output prints one JSON object per line. Defaults to plain.
—source
If specified, display logs from this source. Default:kubernetes. Valid options: kubernetes or containerd
—all
Search across all instances instead of a single instance. Requires--since, --after, or --before to bound the query.