kubectl-logs
prints container logs from a pod
TLDR
View pod logs
SYNOPSIS
kubectl logs [options] pod-name
DESCRIPTION
kubectl logs retrieves and displays the standard output and standard error streams from containers running inside Kubernetes pods. It is one of the primary tools for debugging application behavior, diagnosing crashes, and monitoring runtime output in a cluster environment.
The command supports real-time log streaming with the -f flag, similar to `tail -f`, and can target a specific container within a multi-container pod using the -c option. You can also view logs from a previous container instance (useful for inspecting crash loops via --previous), limit output to recent entries with --tail, or filter by time window using --since and --since-time. When used with label selectors, it can aggregate logs across multiple pods simultaneously.
PARAMETERS
-f, --follow
Stream logs continuously.-c, --container name
Container name.--previous
Print previous container logs.--tail lines
Number of lines from end.--since duration
Show logs newer than duration.--timestamps
Include timestamps.
SEE ALSO
kubectl(1), kubectl-exec(1)
