Make it more obvious that parser succeeded but was whitelisted (#2167)

* Make it more obvious that parser succeeded but was whitelisted

* Add more verbose by placing whitelist reason next to why it is ignored
This commit is contained in:
Laurence Jones 2023-04-12 10:48:42 +01:00 committed by GitHub
parent 7fa469d0b0
commit 9a5a937695
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -348,6 +348,7 @@ func DumpTree(parser_results ParserResults, bucket_pour BucketPourInfo, opts Dum
yellow := color.New(color.FgYellow).SprintFunc()
red := color.New(color.FgRed).SprintFunc()
green := color.New(color.FgGreen).SprintFunc()
whitelistReason := ""
//get each line
for tstamp, rawstr := range assoc {
if opts.SkipOk {
@ -407,6 +408,9 @@ func DumpTree(parser_results ParserResults, bucket_pour BucketPourInfo, opts Dum
detailsDisplay += fmt.Sprintf("\t%s\t\t%s %s evt.%s : %s -> %s\n", presep, sep, change.Type, strings.Join(change.Path, "."), change.From, yellow(change.To))
if change.Path[0] == "Whitelisted" && change.To == true {
whitelisted = true
if whitelistReason == "" {
whitelistReason = parsers[parser].Evt.WhitelistReason
}
}
updated++
case "delete":
@ -459,6 +463,8 @@ func DumpTree(parser_results ParserResults, bucket_pour BucketPourInfo, opts Dum
//did the event enter the bucket pour phase ?
if _, ok := state[tstamp]["buckets"]["OK"]; ok {
fmt.Printf("\t%s-------- parser success %s\n", sep, emoji.GreenCircle)
} else if whitelistReason != "" {
fmt.Printf("\t%s-------- parser success, ignored by whitelist (%s) %s\n", sep, whitelistReason, emoji.GreenCircle)
} else {
fmt.Printf("\t%s-------- parser failure %s\n", sep, emoji.RedCircle)
}