Support extended pod logging options
Increase the supported controls on pod logging. Add validaiton to pod log options. Ensure the Kubelet is using a consistent, structured way to process pod log arguments. Add ?sinceSeconds=<durationInSeconds>, &sinceTime=<RFC3339>, ?timestamps=<bool>, ?tailLines=<number>, and ?limitBytes=<number>
This commit is contained in:
@@ -47,14 +47,20 @@ kubectl logs [-f] [-p] POD [-c CONTAINER]
|
||||
### Examples
|
||||
|
||||
```
|
||||
# Return snapshot of ruby-container logs from pod 123456-7890.
|
||||
$ kubectl logs 123456-7890 ruby-container
|
||||
# Return snapshot logs from pod nginx with only one container
|
||||
$ kubectl logs nginx
|
||||
|
||||
# Return snapshot of previous terminated ruby-container logs from pod 123456-7890.
|
||||
$ kubectl logs -p 123456-7890 ruby-container
|
||||
# Return snapshot of previous terminated ruby container logs from pod web-1
|
||||
$ kubectl logs -p -c ruby web-1
|
||||
|
||||
# Start streaming of ruby-container logs from pod 123456-7890.
|
||||
$ kubectl logs -f 123456-7890 ruby-container
|
||||
# Begin streaming the logs of the ruby container in pod web-1
|
||||
$ kubectl logs -f -c ruby web-1
|
||||
|
||||
# Display only the most recent 20 lines of output in pod nginx
|
||||
$ kubectl logs --tail=20 nginx
|
||||
|
||||
# Show all logs from pod nginx written in the last hour
|
||||
$ kubectl logs --since=1h nginx
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -63,7 +69,12 @@ $ kubectl logs -f 123456-7890 ruby-container
|
||||
-c, --container="": Container name
|
||||
-f, --follow[=false]: Specify if the logs should be streamed.
|
||||
--interactive[=true]: If true, prompt the user for input when required. Default true.
|
||||
--limit-bytes=0: Maximum bytes of logs to return. Defaults to no limit.
|
||||
-p, --previous[=false]: If true, print the logs for the previous instance of the container in a pod if it exists.
|
||||
--since=0: 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="": Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.
|
||||
--tail=-1: Lines of recent log file to display. Defaults to -1, showing all log lines.
|
||||
--timestamps[=false]: Include timestamps on each line in the log output
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
@@ -98,7 +109,7 @@ $ kubectl logs -f 123456-7890 ruby-container
|
||||
|
||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-09-10 18:53:03.154570214 +0000 UTC
|
||||
###### Auto generated by spf13/cobra at 2015-09-16 18:54:52.319210951 +0000 UTC
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
[]()
|
||||
|
Reference in New Issue
Block a user