kubectl logs <TYPE | TYPE/NAME> [Resource]

Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional

Arguments

NameDescription
TYPE | TYPE/NAME
Resource

Options

NameDescription
-l, --selector <arg>Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
--all-containersGet all containers' logs in the pod(s)
-c, --container <arg>Print the logs of this container
-f, --followSpecify if the logs should be streamed
--ignore-errorsIf watching / following pod logs, allow for any errors that occur to be non-fatal
--insecure-skip-tls-verify-backendSkip verifying the identity of the kubelet that logs are requested from. In theory, an attacker could provide invalid log content back. You might want to use this if your kubelet serving certificates have expired
--limit-bytes <arg>Maximum bytes of logs to return. Defaults to no limit
--max-log-requests <arg>Specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5
--pod-running-timeout <arg>The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running
--prefixPrefix each log line with the log source (pod name and container name)
-p, --previousIf true, print the logs for the previous instance of the container in a pod if it exists
--since <arg>Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used
--since-time <arg>Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used
--tail <arg>Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise 10, if a selector is provided
--timestampsInclude timestamps on each line in the log output