@@ -57,18 +57,33 @@ var (
57
57
# Return snapshot logs from pod nginx with only one container
58
58
kubectl logs nginx
59
59
60
+ # Return snapshot logs from pod nginx, prefixing each line with the source pod and container name
61
+ kubectl logs nginx --prefix
62
+
63
+ # Return snapshot logs from pod nginx, limiting output to 500 bytes
64
+ kubectl logs nginx --limit-bytes=500
65
+
66
+ # Return snapshot logs from pod nginx, waiting up to 20 seconds for it to start running.
67
+ kubectl logs nginx --pod-running-timeout=20s
68
+
60
69
# Return snapshot logs from pod nginx with multi containers
61
70
kubectl logs nginx --all-containers=true
62
71
63
- # Return snapshot logs from all pods in the deployment nginx.
72
+ # Return snapshot logs from all pods in the deployment nginx
64
73
kubectl logs deployment/nginx --all-pods=true
65
74
66
75
# Return snapshot logs from all containers in pods defined by label app=nginx
67
76
kubectl logs -l app=nginx --all-containers=true
68
77
78
+ # Return snapshot logs from all pods defined by label app=nginx, limiting concurrent log requests to 10 pods
79
+ kubectl logs -l app=nginx --max-log-requests=10
80
+
69
81
# Return snapshot of previous terminated ruby container logs from pod web-1
70
82
kubectl logs -p -c ruby web-1
71
83
84
+ # Begin streaming the logs from pod nginx, continuing even if errors occur
85
+ kubectl logs nginx -f --ignore-errors=true
86
+
72
87
# Begin streaming the logs of the ruby container in pod web-1
73
88
kubectl logs -f -c ruby web-1
74
89
80
95
81
96
# Show all logs from pod nginx written in the last hour
82
97
kubectl logs --since=1h nginx
98
+
99
+ # Show all logs with timestamps from pod nginx starting from August 30, 2024, at 06:00:00 UTC
100
+ kubectl logs nginx --since-time=2024-08-30T06:00:00Z --timestamps=true
83
101
84
102
# Show logs from a kubelet with an expired serving certificate
85
103
kubectl logs --insecure-skip-tls-verify-backend nginx
0 commit comments