forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 9
/
config.go
40 lines (31 loc) · 973 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
36
37
38
39
40
// Package config provides the winlogbeat specific configuration options.
package config
import (
"fmt"
"github.com/joeshaw/multierror"
"github.com/elastic/beats/libbeat/common"
)
const (
// DefaultRegistryFile specifies the default filename of the registry file.
DefaultRegistryFile = ".winlogbeat.yml"
)
var (
DefaultSettings = WinlogbeatConfig{
RegistryFile: DefaultRegistryFile,
}
)
// WinlogbeatConfig contains all of Winlogbeat configuration data.
type WinlogbeatConfig struct {
EventLogs []*common.Config `config:"event_logs"`
RegistryFile string `config:"registry_file"`
}
// Validate validates the WinlogbeatConfig data and returns an error describing
// all problems or nil if there are none.
func (ebc WinlogbeatConfig) Validate() error {
var errs multierror.Errors
if len(ebc.EventLogs) == 0 {
errs = append(errs, fmt.Errorf("At least one event log must be "+
"configured as part of event_logs"))
}
return errs.Err()
}