Usage
Arguments
Name of the pod to get logs from
Flags
Container name (required for multi-container pods)
Follow log output (stream logs in real-time)
Get logs from the previous terminated container
Number of lines from the end of logs to show
Show logs since a duration (e.g., 1h, 30m, 10s)
Include timestamps on each line
Get logs from all containers in the pod
Kubernetes namespace
Examples
Get recent logs from a pod
Follow logs in real-time
Get logs from a specific container
Get last 50 lines with timestamps
Get logs from the last hour
Get logs from all containers
Get logs from previous container instance
Useful when a container has crashed and restarted:Get logs from a pod in a different namespace
If a pod has multiple containers, you must specify the container name using
-c or use --all-containers to see logs from all containers.