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
3 changes: 2 additions & 1 deletion CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
info from the cloud.machine.type and cloud.availability_zone. {issue}10968[10968]
- Empty `meta.json` file will be treated as a missing meta file. {issue}8558[8558]
- Rename `migration.enabled` config to `migration.6_to_7.enabled`. {pull}11284[11284]
- Report faulting file when config reload fails. {pull}[11304]11304
- Beats Xpack now checks for Basic license on connect. {pull}11296[11296]

*Auditbeat*
Expand Down Expand Up @@ -174,7 +175,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add on_failure handler for Zeek ingest pipelines. Fix one field name error for notice and add an additional test case. {issue}11004[11004] {pull}11105[11105]
- Fix goroutine leak happening when harvesters are dynamically stopped. {pull}11263[11263]
- Fix issue preventing docker container events to be stored if the container has a network interface without ip address. {issue}11225[11225] {pull}11247[11247]
- Add on_failure handler for Zeek ingest pipelines. Fix one field name error for notice and add an additional test
- Add on_failure handler for Zeek ingest pipelines. Fix one field name error for notice and add an additional test
case. {issue}11004[11004] {pull}11105[11105]
- Change URLPATH grok pattern to support brackets. {issue}11135[11135] {pull}11252[11252]
- Add support for iis log with different address format. {issue}11255[11255] {pull}11256[11256]
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