forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
35 lines (29 loc) · 845 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package prospector
import (
"fmt"
"regexp"
"time"
cfg "github.com/elastic/beats/filebeat/config"
)
var (
defaultConfig = prospectorConfig{
IgnoreOlder: 0,
ScanFrequency: 10 * time.Second,
InputType: cfg.DefaultInputType,
CleanOlder: 0,
}
)
type prospectorConfig struct {
ExcludeFiles []*regexp.Regexp `config:"exclude_files"`
IgnoreOlder time.Duration `config:"ignore_older"`
Paths []string `config:"paths"`
ScanFrequency time.Duration `config:"scan_frequency"`
InputType string `config:"input_type"`
CleanOlder time.Duration `config:"clean_older" validate:"min=0"`
}
func (config *prospectorConfig) Validate() error {
if config.InputType == cfg.LogInputType && len(config.Paths) == 0 {
return fmt.Errorf("No paths were defined for prospector")
}
return nil
}