Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.18] Fix bug report missing all logs for json logs #45026

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix format
  • Loading branch information
syw14 authored and istio-testing committed May 22, 2023
commit 153544a571e63173d0bd45d03d8e1556edcb4db2
8 changes: 2 additions & 6 deletions tools/bug-report/pkg/processlog/processlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ func getStats(config *config.BugReportConfig, logStr string) *Stats {
func parseLog(line string) (timeStamp *time.Time, level string, text string, valid bool) {
if isJSONLog(line) {
return parseJSONLog(line)
} else {
return processPlainLog(line)
}
return processPlainLog(line)
}

func processPlainLog(line string) (timeStamp *time.Time, level string, text string, valid bool) {
Expand Down Expand Up @@ -179,8 +178,5 @@ func parseJSONLog(line string) (timeStamp *time.Time, level string, text string,
}

func isJSONLog(logStr string) bool {
if strings.HasPrefix(logStr, "{") {
return true
}
return false
return strings.HasPrefix(logStr, "{")
}