pt-galera-log-explainer: add --skip-merge, grep -a

--skip-merge can help for cases where merge won't work: node names
intentionally identical
grep -a enables to read logs even though they use binary format
This commit is contained in:
Yoann La Cancellera
2024-01-23 09:42:37 +01:00
parent 3939b9e411
commit 8d3cab91d4
2 changed files with 4 additions and 3 deletions

View File

@@ -69,7 +69,7 @@ func timelineFromPaths(paths []string, regexes types.RegexMap) (types.Timeline,
// Why it should not just identify using the file path:
// so that we are able to merge files that belong to the same nodes
// we wouldn't want them to be shown as from different nodes
if CLI.PxcOperator {
if CLI.PxcOperator || CLI.SkipMerge {
timeline[path] = localTimeline
} else if CLI.MergeByDirectory {
timeline.MergeByDirectory(path, localTimeline)
@@ -129,7 +129,7 @@ func execGrepAndIterate(path, compiledRegex string, stdout chan<- string) error
logger.Warn().Msg("On Darwin systems, use 'pt-galera-log-explainer --grep-cmd=ggrep' as it requires grep v3")
}
cmd := exec.Command(CLI.GrepCmd, "-P", compiledRegex, path)
cmd := exec.Command(CLI.GrepCmd, "-a", "-P", compiledRegex, path)
out, err := cmd.StdoutPipe()
if err != nil {

View File

@@ -35,9 +35,10 @@ var CLI struct {
PxcOperator bool `default:"false" help:"Analyze logs from Percona PXC operator. Off by default because it negatively impacts performance for non-k8s setups"`
ExcludeRegexes []string `help:"Remove regexes from analysis. List regexes using 'pt-galera-log-explainer regex-list'"`
MergeByDirectory bool `help:"Instead of relying on identification, merge contexts and columns by base directory. Very useful when dealing with many small logs organized per directories."`
SkipMerge bool `help:"Disable the ability to merge log files together. Can be used when every nodes have the same wsrep_node_name"`
List list `cmd:""`
//Whois whois `cmd:""`
//Whois whois `cmd:""`
// Sed sed `cmd:""`
Ctx ctx `cmd:""`
RegexList regexList `cmd:""`