Skip to content

Commit

Permalink
Merge pull request #5249 from tstromberg/mologs
Browse files Browse the repository at this point in the history
More logs: exited containers, controller manager, double line count
  • Loading branch information
tstromberg authored Sep 3, 2019
2 parents 5c8afbb + c32cb09 commit 2635734
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
8 changes: 6 additions & 2 deletions pkg/minikube/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2635734

Please sign in to comment.