Merge pull request #15770 from nickmancari/new-last-start-only-flag

add new flag --last-start-only to only show last start logs
pull/15822/head
Steven Powell 2023-02-08 13:36:52 -08:00 committed by GitHub
commit 7ad68725b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 28 additions and 8 deletions

View File

@ -52,6 +52,8 @@ var (
fileOutput string
// auditLogs only shows the audit logs
auditLogs bool
// lastStartOnly shows logs from last start
lastStartOnly bool
)
// logsCmd represents the logs command
@ -75,6 +77,13 @@ var logsCmd = &cobra.Command{
exit.Error(reason.Usage, "Failed to create file", err)
}
}
if lastStartOnly {
err := logs.OutputLastStart()
if err != nil {
klog.Errorf("failed to output last start logs: %v", err)
}
return
}
if auditLogs {
err := logs.OutputAudit(numberOfLines)
if err != nil {
@ -150,4 +159,5 @@ func init() {
logsCmd.Flags().StringVar(&nodeName, "node", "", "The node to get logs from. Defaults to the primary control plane.")
logsCmd.Flags().StringVar(&fileOutput, "file", "", "If present, writes to the provided file instead of stdout.")
logsCmd.Flags().BoolVar(&auditLogs, "audit", false, "Show only the audit logs")
logsCmd.Flags().BoolVar(&lastStartOnly, "last-start-only", false, "Show only the last start logs.")
}

View File

@ -221,7 +221,7 @@ func OutputAudit(lines int) error {
}
// outputLastStart outputs the last start logs.
func outputLastStart() error {
func OutputLastStart() error {
out.Styled(style.Empty, "")
out.Styled(style.Empty, "==> Last Start <==")
fp := localpath.LastStartLog()
@ -256,7 +256,7 @@ func OutputOffline(lines int, logOutput *os.File) {
if err := OutputAudit(lines); err != nil {
klog.Errorf("failed to output audit logs: %v", err)
}
if err := outputLastStart(); err != nil {
if err := OutputLastStart(); err != nil {
klog.Errorf("failed to output last start logs: %v", err)
}

View File

@ -20,12 +20,13 @@ minikube logs [flags]
### Options
```
--audit Show only the audit logs
--file string If present, writes to the provided file instead of stdout.
-f, --follow Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.
-n, --length int Number of lines back to go within the log (default 60)
--node string The node to get logs from. Defaults to the primary control plane.
--problems Show only log entries which point to known problems
--audit Show only the audit logs
--file string If present, writes to the provided file instead of stdout.
-f, --follow Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.
--last-start-only Show only the last start logs.
-n, --length int Number of lines back to go within the log (default 60)
--node string The node to get logs from. Defaults to the primary control plane.
--problems Show only log entries which point to known problems
```
### Options inherited from parent commands

View File

@ -601,6 +601,7 @@
"Show a list of global command-line options (applies to all commands).": "Zeige eine Liste von globalen Kommandozeilen Parametern (die auf alle Befehle angewendet werden können)",
"Show only log entries which point to known problems": "Zeige nur Log Einträge, die auf bekannte Probleme hinweisen",
"Show only the audit logs": "",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "Zeige die aktuellsten Journal Einträge und gebe neue Einträge aus, sobald diese im Journal eingetragen werden.",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "Simuliere den Numa Node Count in Minikube, der unterstützte Numa Node Count Bereich ist 1-8 (nur kvm2 Treiber)",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "Wechsel des kubectl Kontexts für {{.profile_name}} übersprungen, weil --keep-context gesetzt wurde.",

View File

@ -606,6 +606,7 @@
"Show a list of global command-line options (applies to all commands).": "",
"Show only log entries which point to known problems": "",
"Show only the audit logs": "",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "",

View File

@ -587,6 +587,7 @@
"Show a list of global command-line options (applies to all commands).": "Affiche une liste des options de ligne de commande globales (s'applique à toutes les commandes).",
"Show only log entries which point to known problems": "Afficher uniquement les entrées de journal qui pointent vers des problèmes connus",
"Show only the audit logs": "Afficher uniquement les journaux d'audit",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "Affichez uniquement les entrées de journal les plus récentes et imprimez en continu de nouvelles entrées au fur et à mesure qu'elles sont ajoutées au journal.",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "Simulez le nombre de nœuds numa dans minikube, la plage de nombre de nœuds numa pris en charge est de 1 à 8 (pilote kvm2 uniquement)",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "Changement de contexte kubectl ignoré pour {{.profile_name}} car --keep-context a été défini.",

View File

@ -569,6 +569,7 @@
"Show a list of global command-line options (applies to all commands).": "(全コマンドに適用される) グローバルコマンドラインオプションの一覧を表示します。",
"Show only log entries which point to known problems": "既知の問題を示すログエントリーのみ表示します",
"Show only the audit logs": "監査ログのみ表示します",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "直近のジャーナルエントリーのみ表示し、ジャーナルに追加された新しいエントリーを連続して表示します。",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "minikube 中の NUMA ノードカウントをシミュレートします (対応 NUMA ノードカウント範囲は 18 (kvm2 ドライバーのみ))",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "--keep-context が設定されたので、{{.profile_name}} 用 kubectl コンテキストの切替をスキップしました。",

View File

@ -616,6 +616,7 @@
"Show a list of global command-line options (applies to all commands).": "",
"Show only log entries which point to known problems": "",
"Show only the audit logs": "",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "",

View File

@ -620,6 +620,7 @@
"Show a list of global command-line options (applies to all commands).": "",
"Show only log entries which point to known problems": "Pokaż logi które wskazują na znane problemy",
"Show only the audit logs": "",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "Zignorowano zmianę kontekstu kubectl dla {{.profile_name}} ponieważ --keep-context zostało przekazane",

View File

@ -564,6 +564,7 @@
"Show a list of global command-line options (applies to all commands).": "",
"Show only log entries which point to known problems": "",
"Show only the audit logs": "",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "",

View File

@ -564,6 +564,7 @@
"Show a list of global command-line options (applies to all commands).": "",
"Show only log entries which point to known problems": "",
"Show only the audit logs": "",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "",

View File

@ -703,6 +703,7 @@
"Show a list of global command-line options (applies to all commands).": "显示全局命令行选项列表 (应用于所有命令)。",
"Show only log entries which point to known problems": "",
"Show only the audit logs": "",
"Show only the last start logs.": "",
"Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.": "",
"Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)": "",
"Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.": "",