From c32cb098b0f7459bc226b55b5e644a3479ebad36 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Tue, 3 Sep 2019 10:34:44 -0700 Subject: [PATCH] More logs: exited containers, controller manager, double line count --- cmd/minikube/cmd/logs.go | 2 +- pkg/minikube/logs/logs.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/minikube/cmd/logs.go b/cmd/minikube/cmd/logs.go index 0b9bb55b4a45..85269cefddc2 100644 --- a/cmd/minikube/cmd/logs.go +++ b/cmd/minikube/cmd/logs.go @@ -97,5 +97,5 @@ var logsCmd = &cobra.Command{ func init() { logsCmd.Flags().BoolVarP(&followLogs, "follow", "f", false, "Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.") logsCmd.Flags().BoolVar(&showProblems, "problems", false, "Show only log entries which point to known problems") - logsCmd.Flags().IntVarP(&numberOfLines, "length", "n", 30, "Number of lines back to go within the log") + logsCmd.Flags().IntVarP(&numberOfLines, "length", "n", 60, "Number of lines back to go within the log") } diff --git a/pkg/minikube/logs/logs.go b/pkg/minikube/logs/logs.go index 8897c4e0c215..69e9f023a387 100644 --- a/pkg/minikube/logs/logs.go +++ b/pkg/minikube/logs/logs.go @@ -36,7 +36,7 @@ import ( // rootCauseRe is a regular expression that matches known failure root causes var rootCauseRe = regexp.MustCompile(`^error: |eviction manager: pods.* evicted|unknown flag: --|forbidden.*no providers available|eviction manager:.*evicted|tls: bad certificate|kubelet.*no API client|kubelet.*No api server|STDIN.*127.0.0.1:8080`) -// ignoreRe is a regular expression that matches spurious errors to not surface +// ignoreCauseRe is a regular expression that matches spurious errors to not surface var ignoreCauseRe = regexp.MustCompile("error: no objects passed to apply") // importantPods are a list of pods to retrieve logs for, in addition to the bootstrapper logs. @@ -48,6 +48,7 @@ var importantPods = []string{ "kube-addon-manager", "kubernetes-dashboard", "storage-provisioner", + "kube-controller-manager", } // lookbackwardsCount is how far back to look in a log for problems. This should be large enough to @@ -161,7 +162,10 @@ func logCommands(r cruntime.Manager, bs bootstrapper.Bootstrapper, length int, f glog.Warningf("No container was found matching %q", pod) continue } - cmds[pod] = r.ContainerLogCmd(ids[0], length, follow) + for _, i := range ids { + key := fmt.Sprintf("%s [%s]", pod, i) + cmds[key] = r.ContainerLogCmd(i, length, follow) + } } cmds[r.Name()] = r.SystemLogCmd(length) // Works across container runtimes with good formatting