| 66 | } |
| 67 | |
| 68 | func (n *Node) validate(ectx EnricherCtx) error { |
| 69 | // stage is being set automagically |
| 70 | if n.Stage == "" { |
| 71 | return errors.New("stage needs to be an existing stage") |
| 72 | } |
| 73 | |
| 74 | /* "" behaves like continue */ |
| 75 | if n.OnSuccess != "continue" && n.OnSuccess != "next_stage" && n.OnSuccess != "" { |
| 76 | return fmt.Errorf("onsuccess %q not continue,next_stage", n.OnSuccess) |
| 77 | } |
| 78 | |
| 79 | if n.Filter != "" && n.RunTimeFilter == nil { |
| 80 | return fmt.Errorf("non-empty filter %q was not compiled", n.Filter) |
| 81 | } |
| 82 | |
| 83 | if n.RuntimeGrok.RunTimeRegexp != nil || n.Grok.TargetField != "" { |
| 84 | if err := n.Grok.Validate(); err != nil { |
| 85 | return err |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | for idx, static := range n.Statics { |
| 90 | if err := static.Validate(ectx); err != nil { |
| 91 | return fmt.Errorf("static %d: %w", idx, err) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | for idx, stash := range n.Stashes { |
| 96 | if err := stash.Validate(); err != nil { |
| 97 | return fmt.Errorf("stash %d: %w", idx, err) |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | return nil |
| 102 | } |
| 103 | |
| 104 | func (n *Node) processFilter(cachedExprEnv map[string]any) (bool, error) { |
| 105 | clog := n.Logger |