Add output you can stream matches into, so we don't spwan a process at each match
This commit is contained in:
@ -21,6 +21,15 @@ func (c *Conf) setup() {
|
||||
c.Concurrency = runtime.NumCPU()
|
||||
}
|
||||
|
||||
for outputName := range c.Outputs {
|
||||
output := c.Outputs[outputName]
|
||||
output.name = outputName
|
||||
|
||||
if len(output.Start) == 0 {
|
||||
logger.Fatalf("Bad configuration: output's start %v is empty!", outputName)
|
||||
}
|
||||
}
|
||||
|
||||
for patternName := range c.Patterns {
|
||||
pattern := c.Patterns[patternName]
|
||||
pattern.name = patternName
|
||||
@ -136,6 +145,20 @@ func (c *Conf) setup() {
|
||||
if filter.longuestActionDuration == nil || filter.longuestActionDuration.Milliseconds() < action.afterDuration.Milliseconds() {
|
||||
filter.longuestActionDuration = &action.afterDuration
|
||||
}
|
||||
|
||||
if action.Write != nil {
|
||||
found := false
|
||||
for oname := range c.Outputs {
|
||||
if strings.EqualFold(oname, action.Write.OutputName) {
|
||||
action.Write.Output = c.Outputs[oname]
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
logger.Fatalln(fmt.Sprintf("Bad configuration: action %s.%s.%s refers to undeclared output %s",
|
||||
stream.name, filter.name, action.name, action.Write.OutputName))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user