forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
34 lines (28 loc) · 800 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
package fileout
import (
"fmt"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/libbeat/outputs/codec"
)
type config struct {
Path string `config:"path"`
Filename string `config:"filename"`
RotateEveryKb int `config:"rotate_every_kb" validate:"min=1"`
NumberOfFiles int `config:"number_of_files"`
Codec codec.Config `config:"codec"`
Permissions uint32 `config:"permissions"`
}
var (
defaultConfig = config{
NumberOfFiles: 7,
RotateEveryKb: 10 * 1024,
Permissions: 0600,
}
)
func (c *config) Validate() error {
if c.NumberOfFiles < 2 || c.NumberOfFiles > logp.RotatorMaxFiles {
return fmt.Errorf("The number_of_files to keep should be between 2 and %v",
logp.RotatorMaxFiles)
}
return nil
}