Skip to content

Commit

Permalink
Fix date check and accept multiple predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-gr committed Nov 28, 2024
1 parent a798085 commit d9d8004
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion x-pack/filebeat/input/unifiedlogs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
type config struct {
ArchiveFile string `config:"archive_file"`
TraceFile string `config:"trace_file"`
Predicate string `config:"predicate"`
Predicate []string `config:"predicate"`
Process []string `config:"process"`
Source bool `config:"source"`
Info bool `config:"info"`
Expand Down Expand Up @@ -45,6 +45,9 @@ func defaultConfig() config {
}

func checkDateFormat(date string) error {
if date == "" {
return nil
}
acceptedLayouts := []string{
"2006-01-02",
"2006-01-02 15:04:05",
Expand Down
6 changes: 4 additions & 2 deletions x-pack/filebeat/input/unifiedlogs/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ func newLogCmd(ctx context.Context, config config, resumeCursor inputcursor.Curs
if config.TraceFile != "" {
args = append(args, "--file", config.TraceFile)
}
if config.Predicate != "" {
args = append(args, "--predicate", config.Predicate)
if len(config.Predicate) > 0 {
for _, p := range config.Predicate {
args = append(args, "--predicate", p)
}
}
if len(config.Process) > 0 {
for _, p := range config.Process {
Expand Down

0 comments on commit d9d8004

Please sign in to comment.