diff --git a/contrib/completions/bash/kubectl b/contrib/completions/bash/kubectl index b137c008582..d5a05a1b838 100644 --- a/contrib/completions/bash/kubectl +++ b/contrib/completions/bash/kubectl @@ -388,9 +388,9 @@ _kubectl_namespace() must_have_one_noun=() } -_kubectl_log() +_kubectl_logs() { - last_command="kubectl_log" + last_command="kubectl_logs" commands=() flags=() @@ -895,7 +895,7 @@ _kubectl() commands+=("update") commands+=("delete") commands+=("namespace") - commands+=("log") + commands+=("logs") commands+=("rolling-update") commands+=("resize") commands+=("exec") diff --git a/docs/.files_generated b/docs/.files_generated index 2b5aff7b6f6..789cfe55ccc 100644 --- a/docs/.files_generated +++ b/docs/.files_generated @@ -16,7 +16,7 @@ kubectl_exec.md kubectl_expose.md kubectl_get.md kubectl_label.md -kubectl_log.md +kubectl_logs.md kubectl_namespace.md kubectl_port-forward.md kubectl_proxy.md diff --git a/docs/kubectl.md b/docs/kubectl.md index 02412911d28..664e8adc06b 100644 --- a/docs/kubectl.md +++ b/docs/kubectl.md @@ -54,7 +54,7 @@ kubectl * [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 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 logs](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 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 diff --git a/docs/kubectl_log.md b/docs/kubectl_logs.md similarity index 88% rename from docs/kubectl_log.md rename to docs/kubectl_logs.md index 2b990d3fc12..73964e20c64 100644 --- a/docs/kubectl_log.md +++ b/docs/kubectl_logs.md @@ -1,4 +1,4 @@ -## kubectl log +## kubectl logs 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. ``` -kubectl log [-f] [-p] POD [CONTAINER] +kubectl logs [-f] [-p] POD [CONTAINER] ``` ### Examples ``` // Returns snapshot of ruby-container logs from pod 123456-7890. -$ kubectl log 123456-7890 ruby-container +$ kubectl logs 123456-7890 ruby-container // Returns snapshot of previous terminated ruby-container logs from pod 123456-7890. -$ kubectl log -p 123456-7890 ruby-container +$ kubectl logs -p 123456-7890 ruby-container // Starts streaming of ruby-container logs from pod 123456-7890. -$ kubectl log -f 123456-7890 ruby-container +$ kubectl logs -f 123456-7890 ruby-container ``` ### Options ``` -f, --follow=false: Specify if the logs should be streamed. - -h, --help=false: help for log + -h, --help=false: help for logs --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. ``` @@ -65,6 +65,6 @@ $ kubectl log -f 123456-7890 ruby-container ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-05-15 00:05:04.551041505 +0000 UTC +###### Auto generated by spf13/cobra at 2015-05-21 20:24:03.06578685 +0000 UTC -[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/kubectl_log.md?pixel)]() +[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/kubectl_logs.md?pixel)]() diff --git a/docs/man/man1/.files_generated b/docs/man/man1/.files_generated index 0cd2019d1f0..3edf75fc4d3 100644 --- a/docs/man/man1/.files_generated +++ b/docs/man/man1/.files_generated @@ -15,7 +15,7 @@ kubectl-exec.1 kubectl-expose.1 kubectl-get.1 kubectl-label.1 -kubectl-log.1 +kubectl-logs.1 kubectl-namespace.1 kubectl-port-forward.1 kubectl-proxy.1 diff --git a/docs/man/man1/kubectl-log.1 b/docs/man/man1/kubectl-logs.1 similarity index 92% rename from docs/man/man1/kubectl-log.1 rename to docs/man/man1/kubectl-logs.1 index b16924b3db0..97d2da1ff40 100644 --- a/docs/man/man1/kubectl-log.1 +++ b/docs/man/man1/kubectl-logs.1 @@ -3,12 +3,12 @@ .SH NAME .PP -kubectl log \- Print the logs for a container in a pod. +kubectl logs \- Print the logs for a container in a pod. .SH SYNOPSIS .PP -\fBkubectl log\fP [OPTIONS] +\fBkubectl logs\fP [OPTIONS] .SH DESCRIPTION @@ -23,7 +23,7 @@ Print the logs for a container in a pod. If the pod has only one container, the .PP \fB\-h\fP, \fB\-\-help\fP=false - help for log + help for logs .PP \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 .nf // Returns snapshot of ruby\-container logs from pod 123456\-7890. -$ kubectl log 123456\-7890 ruby\-container +$ kubectl logs 123456\-7890 ruby\-container // Returns snapshot of previous terminated ruby\-container logs from pod 123456\-7890. -$ kubectl log \-p 123456\-7890 ruby\-container +$ kubectl logs \-p 123456\-7890 ruby\-container // Starts streaming of ruby\-container logs from pod 123456\-7890. -$ kubectl log \-f 123456\-7890 ruby\-container +$ kubectl logs \-f 123456\-7890 ruby\-container .fi .RE diff --git a/docs/man/man1/kubectl.1 b/docs/man/man1/kubectl.1 index 8c0a22ef164..c571f300926 100644 --- a/docs/man/man1/kubectl.1 +++ b/docs/man/man1/kubectl.1 @@ -124,7 +124,7 @@ Find more information at .SH SEE ALSO .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\-logs(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 diff --git a/pkg/kubectl/cmd/log.go b/pkg/kubectl/cmd/log.go index 9378075b500..281f44c44fe 100644 --- a/pkg/kubectl/cmd/log.go +++ b/pkg/kubectl/cmd/log.go @@ -19,6 +19,7 @@ package cmd import ( "fmt" "io" + "os" "strconv" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" @@ -29,13 +30,13 @@ import ( const ( log_example = `// Returns snapshot of ruby-container logs from pod 123456-7890. -$ kubectl log 123456-7890 ruby-container +$ kubectl logs 123456-7890 ruby-container // Returns snapshot of previous terminated ruby-container logs from pod 123456-7890. -$ kubectl log -p 123456-7890 ruby-container +$ kubectl logs -p 123456-7890 ruby-container // Starts streaming of ruby-container logs from pod 123456-7890. -$ kubectl log -f 123456-7890 ruby-container` +$ kubectl logs -f 123456-7890 ruby-container` ) 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 func NewCmdLog(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "log [-f] [-p] POD [CONTAINER]", + Use: "logs [-f] [-p] POD [CONTAINER]", 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.", Example: log_example, @@ -71,6 +72,7 @@ func NewCmdLog(f *cmdutil.Factory, out io.Writer) *cobra.Command { err := RunLog(f, out, cmd, args) cmdutil.CheckErr(err) }, + Aliases: []string{"log"}, } 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.") @@ -80,6 +82,10 @@ func NewCmdLog(f *cmdutil.Factory, out io.Writer) *cobra.Command { // RunLog retrieves a pod log 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 { return cmdutil.UsageError(cmd, "POD is required for log") }