Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report faulting file when config reload fails #11304

Merged
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Include ip and boolean type when generating index pattern. {pull}10995[10995]
- Cancelling enrollment of a beat will not enroll the beat. {issue}10150[10150]
- Add missing fields and test cases for libbeat add_kubernetes_metadata processor. {issue}11133[11133], {pull}11134[11134]
- Report faulting file when config reload fails. {pull}[11304]11304

*Auditbeat*

Expand Down
7 changes: 6 additions & 1 deletion libbeat/cfgfile/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
)

var (
// DefaultDynamicConfig provides default behavior for a Runner.
DefaultDynamicConfig = DynamicConfig{
Reload: Reload{
Period: 10 * time.Second,
Expand All @@ -58,16 +59,20 @@ type DynamicConfig struct {
Reload Reload `config:"reload"`
}

// Reload defines reload behavior and frequency
type Reload struct {
Period time.Duration `config:"period"`
Enabled bool `config:"enabled"`
}

// RunnerFactory is used for creating of new Runners
type RunnerFactory interface {
Create(p beat.Pipeline, config *common.Config, meta *common.MapStrPointer) (Runner, error)
CheckConfig(config *common.Config) error
}

// Runner is a simple interface providing a simple way to
// Start and Stop Reloader
type Runner interface {
// We include fmt.Stringer here because we do log debug messages that must print
// something for the given Runner. We need Runner implementers to consciously implement a
Expand Down Expand Up @@ -220,7 +225,7 @@ func (rl *Reloader) loadConfigs(files []string) ([]*reload.ConfigWithMeta, error
configs, err := LoadList(file)
if err != nil {
errs = append(errs, err)
logp.Err("Error loading config: %s", err)
logp.Err("Error loading config from file '%s', error %v", file, err)
continue
}

Expand Down
4 changes: 3 additions & 1 deletion libbeat/template/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ import (
"github.com/elastic/beats/libbeat/paths"
)

// TemplateLoader is a subset of the Elasticsearch client API capable of
// ESClient is a subset of the Elasticsearch client API capable of
// loading the template.
type ESClient interface {
Request(method, path string, pipeline string, params map[string]string, body interface{}) (int, []byte, error)
GetVersion() common.Version
}

// Loader is a template loader capable of loading the template using
// Elasticsearch Client API
type Loader struct {
config TemplateConfig
client ESClient
Expand Down