Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b7e0cc41
Commit
b7e0cc41
authored
May 26, 2015
by
Saad Ali
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8634 from csrwng/rename_pod_log
Rename 'kubectl log' to 'kubectl logs'
parents
c5525ecf
cb872e92
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
25 deletions
+31
-25
kubectl
contrib/completions/bash/kubectl
+3
-3
.files_generated
docs/.files_generated
+1
-1
kubectl.md
docs/kubectl.md
+1
-1
kubectl_logs.md
docs/kubectl_logs.md
+8
-8
.files_generated
docs/man/man1/.files_generated
+1
-1
kubectl-logs.1
docs/man/man1/kubectl-logs.1
+6
-6
kubectl.1
docs/man/man1/kubectl.1
+1
-1
log.go
pkg/kubectl/cmd/log.go
+10
-4
No files found.
contrib/completions/bash/kubectl
View file @
b7e0cc41
...
@@ -388,9 +388,9 @@ _kubectl_namespace()
...
@@ -388,9 +388,9 @@ _kubectl_namespace()
must_have_one_noun
=()
must_have_one_noun
=()
}
}
_kubectl_log
()
_kubectl_log
s
()
{
{
last_command
=
"kubectl_log"
last_command
=
"kubectl_log
s
"
commands
=()
commands
=()
flags
=()
flags
=()
...
@@ -895,7 +895,7 @@ _kubectl()
...
@@ -895,7 +895,7 @@ _kubectl()
commands+
=(
"update"
)
commands+
=(
"update"
)
commands+
=(
"delete"
)
commands+
=(
"delete"
)
commands+
=(
"namespace"
)
commands+
=(
"namespace"
)
commands+
=(
"log"
)
commands+
=(
"log
s
"
)
commands+
=(
"rolling-update"
)
commands+
=(
"rolling-update"
)
commands+
=(
"resize"
)
commands+
=(
"resize"
)
commands+
=(
"exec"
)
commands+
=(
"exec"
)
...
...
docs/.files_generated
View file @
b7e0cc41
...
@@ -16,7 +16,7 @@ kubectl_exec.md
...
@@ -16,7 +16,7 @@ kubectl_exec.md
kubectl_expose.md
kubectl_expose.md
kubectl_get.md
kubectl_get.md
kubectl_label.md
kubectl_label.md
kubectl_log.md
kubectl_log
s
.md
kubectl_namespace.md
kubectl_namespace.md
kubectl_port-forward.md
kubectl_port-forward.md
kubectl_proxy.md
kubectl_proxy.md
...
...
docs/kubectl.md
View file @
b7e0cc41
...
@@ -54,7 +54,7 @@ kubectl
...
@@ -54,7 +54,7 @@ kubectl
*
[
kubectl expose
](
kubectl_expose.md
)
- Take a replicated application and expose it as Kubernetes Service
*
[
kubectl expose
](
kubectl_expose.md
)
- Take a replicated application and expose it as Kubernetes Service
*
[
kubectl get
](
kubectl_get.md
)
- Display one or many resources
*
[
kubectl get
](
kubectl_get.md
)
- Display one or many resources
*
[
kubectl label
](
kubectl_label.md
)
- Update the labels on a resource
*
[
kubectl label
](
kubectl_label.md
)
- Update the labels on a resource
*
[
kubectl log
](
kubectl_log
.md
)
- Print the logs for a container in a pod.
*
[
kubectl log
s
](
kubectl_logs
.md
)
- Print the logs for a container in a pod.
*
[
kubectl namespace
](
kubectl_namespace.md
)
- SUPERCEDED: Set and view the current Kubernetes namespace
*
[
kubectl namespace
](
kubectl_namespace.md
)
- SUPERCEDED: Set and view the current Kubernetes namespace
*
[
kubectl port-forward
](
kubectl_port-forward.md
)
- Forward one or more local ports to a pod.
*
[
kubectl port-forward
](
kubectl_port-forward.md
)
- Forward one or more local ports to a pod.
*
[
kubectl proxy
](
kubectl_proxy.md
)
- Run a proxy to the Kubernetes API server
*
[
kubectl proxy
](
kubectl_proxy.md
)
- Run a proxy to the Kubernetes API server
...
...
docs/kubectl_log.md
→
docs/kubectl_log
s
.md
View file @
b7e0cc41
## kubectl log
## kubectl log
s
Print the logs for a container in a pod.
Print the logs for a container in a pod.
...
@@ -8,27 +8,27 @@ Print the logs for a container in a pod.
...
@@ -8,27 +8,27 @@ Print the logs for a container in a pod.
Print the logs for a container in a pod. If the pod has only one container, the container name is optional.
Print the logs for a container in a pod. If the pod has only one container, the container name is optional.
```
```
kubectl log [-f] [-p] POD [CONTAINER]
kubectl log
s
[-f] [-p] POD [CONTAINER]
```
```
### Examples
### Examples
```
```
// Returns snapshot of ruby-container logs from pod 123456-7890.
// Returns snapshot of ruby-container logs from pod 123456-7890.
$ kubectl log 123456-7890 ruby-container
$ kubectl log
s
123456-7890 ruby-container
// Returns snapshot of previous terminated ruby-container logs from pod 123456-7890.
// Returns snapshot of previous terminated ruby-container logs from pod 123456-7890.
$ kubectl log -p 123456-7890 ruby-container
$ kubectl log
s
-p 123456-7890 ruby-container
// Starts streaming of ruby-container logs from pod 123456-7890.
// Starts streaming of ruby-container logs from pod 123456-7890.
$ kubectl log -f 123456-7890 ruby-container
$ kubectl log
s
-f 123456-7890 ruby-container
```
```
### Options
### Options
```
```
-f, --follow=false: Specify if the logs should be streamed.
-f, --follow=false: Specify if the logs should be streamed.
-h, --help=false: help for log
-h, --help=false: help for log
s
--interactive=true: If true, prompt the user for input when required. Default true.
--interactive=true: If true, prompt the user for input when required. Default true.
-p, --previous=false: If true, print the logs for the previous instance of the container in a pod if it exists.
-p, --previous=false: If true, print the logs for the previous instance of the container in a pod if it exists.
```
```
...
@@ -65,6 +65,6 @@ $ kubectl log -f 123456-7890 ruby-container
...
@@ -65,6 +65,6 @@ $ kubectl log -f 123456-7890 ruby-container
### SEE ALSO
### SEE ALSO
*
[
kubectl
](
kubectl.md
)
- kubectl controls the Kubernetes cluster manager
*
[
kubectl
](
kubectl.md
)
- kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra at 2015-05-
15 00:05:04.55104150
5 +0000 UTC
###### Auto generated by spf13/cobra at 2015-05-
21 20:24:03.0657868
5 +0000 UTC
[

]()
[

]()
docs/man/man1/.files_generated
View file @
b7e0cc41
...
@@ -15,7 +15,7 @@ kubectl-exec.1
...
@@ -15,7 +15,7 @@ kubectl-exec.1
kubectl-expose.1
kubectl-expose.1
kubectl-get.1
kubectl-get.1
kubectl-label.1
kubectl-label.1
kubectl-log.1
kubectl-log
s
.1
kubectl-namespace.1
kubectl-namespace.1
kubectl-port-forward.1
kubectl-port-forward.1
kubectl-proxy.1
kubectl-proxy.1
...
...
docs/man/man1/kubectl-log.1
→
docs/man/man1/kubectl-log
s
.1
View file @
b7e0cc41
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
.SH NAME
.SH NAME
.PP
.PP
kubectl log \- Print the logs for a container in a pod.
kubectl log
s
\- Print the logs for a container in a pod.
.SH SYNOPSIS
.SH SYNOPSIS
.PP
.PP
\fBkubectl log\fP [OPTIONS]
\fBkubectl log
s
\fP [OPTIONS]
.SH DESCRIPTION
.SH DESCRIPTION
...
@@ -23,7 +23,7 @@ Print the logs for a container in a pod. If the pod has only one container, the
...
@@ -23,7 +23,7 @@ Print the logs for a container in a pod. If the pod has only one container, the
.PP
.PP
\fB\-h\fP, \fB\-\-help\fP=false
\fB\-h\fP, \fB\-\-help\fP=false
help for log
help for log
s
.PP
.PP
\fB\-\-interactive\fP=true
\fB\-\-interactive\fP=true
...
@@ -138,13 +138,13 @@ Print the logs for a container in a pod. If the pod has only one container, the
...
@@ -138,13 +138,13 @@ Print the logs for a container in a pod. If the pod has only one container, the
.nf
.nf
// Returns snapshot of ruby\-container logs from pod 123456\-7890.
// Returns snapshot of ruby\-container logs from pod 123456\-7890.
$ kubectl log 123456\-7890 ruby\-container
$ kubectl log
s
123456\-7890 ruby\-container
// Returns snapshot of previous terminated ruby\-container logs from pod 123456\-7890.
// Returns snapshot of previous terminated ruby\-container logs from pod 123456\-7890.
$ kubectl log \-p 123456\-7890 ruby\-container
$ kubectl log
s
\-p 123456\-7890 ruby\-container
// Starts streaming of ruby\-container logs from pod 123456\-7890.
// Starts streaming of ruby\-container logs from pod 123456\-7890.
$ kubectl log \-f 123456\-7890 ruby\-container
$ kubectl log
s
\-f 123456\-7890 ruby\-container
.fi
.fi
.RE
.RE
...
...
docs/man/man1/kubectl.1
View file @
b7e0cc41
...
@@ -124,7 +124,7 @@ Find more information at
...
@@ -124,7 +124,7 @@ Find more information at
.SH SEE ALSO
.SH SEE ALSO
.PP
.PP
\fBkubectl\-get(1)\fP, \fBkubectl\-describe(1)\fP, \fBkubectl\-create(1)\fP, \fBkubectl\-update(1)\fP, \fBkubectl\-delete(1)\fP, \fBkubectl\-namespace(1)\fP, \fBkubectl\-log(1)\fP, \fBkubectl\-rolling\-update(1)\fP, \fBkubectl\-resize(1)\fP, \fBkubectl\-exec(1)\fP, \fBkubectl\-port\-forward(1)\fP, \fBkubectl\-proxy(1)\fP, \fBkubectl\-run\-container(1)\fP, \fBkubectl\-stop(1)\fP, \fBkubectl\-expose(1)\fP, \fBkubectl\-label(1)\fP, \fBkubectl\-config(1)\fP, \fBkubectl\-cluster\-info(1)\fP, \fBkubectl\-api\-versions(1)\fP, \fBkubectl\-version(1)\fP,
\fBkubectl\-get(1)\fP, \fBkubectl\-describe(1)\fP, \fBkubectl\-create(1)\fP, \fBkubectl\-update(1)\fP, \fBkubectl\-delete(1)\fP, \fBkubectl\-namespace(1)\fP, \fBkubectl\-log
s
(1)\fP, \fBkubectl\-rolling\-update(1)\fP, \fBkubectl\-resize(1)\fP, \fBkubectl\-exec(1)\fP, \fBkubectl\-port\-forward(1)\fP, \fBkubectl\-proxy(1)\fP, \fBkubectl\-run\-container(1)\fP, \fBkubectl\-stop(1)\fP, \fBkubectl\-expose(1)\fP, \fBkubectl\-label(1)\fP, \fBkubectl\-config(1)\fP, \fBkubectl\-cluster\-info(1)\fP, \fBkubectl\-api\-versions(1)\fP, \fBkubectl\-version(1)\fP,
.SH HISTORY
.SH HISTORY
...
...
pkg/kubectl/cmd/log.go
View file @
b7e0cc41
...
@@ -19,6 +19,7 @@ package cmd
...
@@ -19,6 +19,7 @@ package cmd
import
(
import
(
"fmt"
"fmt"
"io"
"io"
"os"
"strconv"
"strconv"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
...
@@ -29,13 +30,13 @@ import (
...
@@ -29,13 +30,13 @@ import (
const
(
const
(
log_example
=
`// Returns snapshot of ruby-container logs from pod 123456-7890.
log_example
=
`// Returns snapshot of ruby-container logs from pod 123456-7890.
$ kubectl log 123456-7890 ruby-container
$ kubectl log
s
123456-7890 ruby-container
// Returns snapshot of previous terminated ruby-container logs from pod 123456-7890.
// Returns snapshot of previous terminated ruby-container logs from pod 123456-7890.
$ kubectl log -p 123456-7890 ruby-container
$ kubectl log
s
-p 123456-7890 ruby-container
// Starts streaming of ruby-container logs from pod 123456-7890.
// Starts streaming of ruby-container logs from pod 123456-7890.
$ kubectl log -f 123456-7890 ruby-container`
$ kubectl log
s
-f 123456-7890 ruby-container`
)
)
func
selectContainer
(
pod
*
api
.
Pod
,
in
io
.
Reader
,
out
io
.
Writer
)
string
{
func
selectContainer
(
pod
*
api
.
Pod
,
in
io
.
Reader
,
out
io
.
Writer
)
string
{
...
@@ -63,7 +64,7 @@ func selectContainer(pod *api.Pod, in io.Reader, out io.Writer) string {
...
@@ -63,7 +64,7 @@ func selectContainer(pod *api.Pod, in io.Reader, out io.Writer) string {
// NewCmdLog creates a new pod log command
// NewCmdLog creates a new pod log command
func
NewCmdLog
(
f
*
cmdutil
.
Factory
,
out
io
.
Writer
)
*
cobra
.
Command
{
func
NewCmdLog
(
f
*
cmdutil
.
Factory
,
out
io
.
Writer
)
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"log [-f] [-p] POD [CONTAINER]"
,
Use
:
"log
s
[-f] [-p] POD [CONTAINER]"
,
Short
:
"Print the logs for a container in a pod."
,
Short
:
"Print the logs for a container in a pod."
,
Long
:
"Print the logs for a container in a pod. If the pod has only one container, the container name is optional."
,
Long
:
"Print the logs for a container in a pod. If the pod has only one container, the container name is optional."
,
Example
:
log_example
,
Example
:
log_example
,
...
@@ -71,6 +72,7 @@ func NewCmdLog(f *cmdutil.Factory, out io.Writer) *cobra.Command {
...
@@ -71,6 +72,7 @@ func NewCmdLog(f *cmdutil.Factory, out io.Writer) *cobra.Command {
err
:=
RunLog
(
f
,
out
,
cmd
,
args
)
err
:=
RunLog
(
f
,
out
,
cmd
,
args
)
cmdutil
.
CheckErr
(
err
)
cmdutil
.
CheckErr
(
err
)
},
},
Aliases
:
[]
string
{
"log"
},
}
}
cmd
.
Flags
()
.
BoolP
(
"follow"
,
"f"
,
false
,
"Specify if the logs should be streamed."
)
cmd
.
Flags
()
.
BoolP
(
"follow"
,
"f"
,
false
,
"Specify if the logs should be streamed."
)
cmd
.
Flags
()
.
Bool
(
"interactive"
,
true
,
"If true, prompt the user for input when required. Default true."
)
cmd
.
Flags
()
.
Bool
(
"interactive"
,
true
,
"If true, prompt the user for input when required. Default true."
)
...
@@ -80,6 +82,10 @@ func NewCmdLog(f *cmdutil.Factory, out io.Writer) *cobra.Command {
...
@@ -80,6 +82,10 @@ func NewCmdLog(f *cmdutil.Factory, out io.Writer) *cobra.Command {
// RunLog retrieves a pod log
// RunLog retrieves a pod log
func
RunLog
(
f
*
cmdutil
.
Factory
,
out
io
.
Writer
,
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
func
RunLog
(
f
*
cmdutil
.
Factory
,
out
io
.
Writer
,
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
len
(
os
.
Args
)
>
1
&&
os
.
Args
[
1
]
==
"log"
{
printDeprecationWarning
(
"logs"
,
"log"
)
}
if
len
(
args
)
==
0
{
if
len
(
args
)
==
0
{
return
cmdutil
.
UsageError
(
cmd
,
"POD is required for log"
)
return
cmdutil
.
UsageError
(
cmd
,
"POD is required for log"
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment