Explain successful parsers only (#2063)
* Add option to filter down explain to successful parsers useful for me who has every collection installed * Altered naming conventions so it makes more sense when reading
This commit is contained in:
parent
8acce4637a
commit
75d8b821ff
|
@ -50,6 +50,12 @@ func runExplain(cmd *cobra.Command, args []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
opts.ShowNotOkParsers, err = flags.GetBool("only-successful-parsers")
|
||||
opts.ShowNotOkParsers = !opts.ShowNotOkParsers
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
crowdsec, err := flags.GetString("crowdsec")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -182,6 +188,7 @@ tail -n 5 myfile.log | cscli explain --type nginx -f -
|
|||
flags.StringP("type", "t", "", "Type of the acquisition to test")
|
||||
flags.BoolP("verbose", "v", false, "Display individual changes")
|
||||
flags.Bool("failures", false, "Only show failed lines")
|
||||
flags.Bool("only-successful-parsers", false, "Only show successful parsers")
|
||||
flags.String("crowdsec", "crowdsec", "Path to crowdsec")
|
||||
|
||||
return cmdExplain
|
||||
|
|
|
@ -301,6 +301,7 @@ func LoadParserDump(filepath string) (*ParserResults, error) {
|
|||
type DumpOpts struct {
|
||||
Details bool
|
||||
SkipOk bool
|
||||
ShowNotOkParsers bool
|
||||
}
|
||||
|
||||
func DumpTree(parser_results ParserResults, bucket_pour BucketPourInfo, opts DumpOpts) {
|
||||
|
@ -445,7 +446,7 @@ func DumpTree(parser_results ParserResults, bucket_pour BucketPourInfo, opts Dum
|
|||
if opts.Details {
|
||||
fmt.Print(detailsDisplay)
|
||||
}
|
||||
} else {
|
||||
} else if opts.ShowNotOkParsers {
|
||||
fmt.Printf("\t%s\t%s %s %s\n", presep, sep, emoji.RedCircle, parser)
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue