Skip to content

Commit ab01874

Browse files
authored
Update logs.go
1 parent 8bb6e02 commit ab01874

File tree

1 file changed

+19
-1
lines changed
  • staging/src/k8s.io/kubectl/pkg/cmd/logs

1 file changed

+19
-1
lines changed

staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,33 @@ var (
5757
# Return snapshot logs from pod nginx with only one container
5858
kubectl logs nginx
5959
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+
6069
# Return snapshot logs from pod nginx with multi containers
6170
kubectl logs nginx --all-containers=true
6271
63-
# Return snapshot logs from all pods in the deployment nginx.
72+
# Return snapshot logs from all pods in the deployment nginx
6473
kubectl logs deployment/nginx --all-pods=true
6574
6675
# Return snapshot logs from all containers in pods defined by label app=nginx
6776
kubectl logs -l app=nginx --all-containers=true
6877
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+
6981
# Return snapshot of previous terminated ruby container logs from pod web-1
7082
kubectl logs -p -c ruby web-1
7183
84+
# Begin streaming the logs from pod nginx, continuing even if errors occur
85+
kubectl logs nginx -f --ignore-errors=true
86+
7287
# Begin streaming the logs of the ruby container in pod web-1
7388
kubectl logs -f -c ruby web-1
7489
@@ -80,6 +95,9 @@ var (
8095
8196
# Show all logs from pod nginx written in the last hour
8297
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
83101
84102
# Show logs from a kubelet with an expired serving certificate
85103
kubectl logs --insecure-skip-tls-verify-backend nginx

0 commit comments

Comments
 (0)