Skip to content

Commit

Permalink
Rename reload config options according to #3430 (#3532)
Browse files Browse the repository at this point in the history
* Update docs
* Update config file

See #3430
  • Loading branch information
ruflin authored and monicasarbu committed Feb 6, 2017
1 parent 5d89c28 commit 21d875f
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion filebeat/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Config struct {
ConfigDir string `config:"config_dir"`
ShutdownTimeout time.Duration `config:"shutdown_timeout"`
Modules []*common.Config `config:"modules"`
ProspectorReload *common.Config `config:"reload.prospectors"`
ProspectorReload *common.Config `config:"config.prospectors"`
}

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ The configuration in the main filebeat.yml config file looks as following:

[source,yaml]
------------------------------------------------------------------------------
filebeat.reload.prospectors:
enabled: true
filebeat.config.prospectors:
path: configs/*.yml
period: 10s
reload.enabled: true
reload.period: 10s
------------------------------------------------------------------------------

A path with a glob must be defined on which files should be checked for changes. A period is set on how often
Expand Down
6 changes: 3 additions & 3 deletions filebeat/tests/system/config/filebeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ filebeat.registry_file: {{ beat.working_dir + '/' }}{{ registryFile|default("reg
filebeat.publish_async: {{publish_async}}

{% if reload -%}
filebeat.reload.prospectors:
filebeat.config.prospectors:
path: {{ reload_path }}
period: 1s
enabled: true
reload.period: 1s
reload.enabled: true
{% endif -%}

#================================ General =====================================
Expand Down
14 changes: 10 additions & 4 deletions libbeat/cfgfile/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import (

var (
DefaultReloadConfig = ReloadConfig{
Period: 10 * time.Second,
Enabled: false,
Reload: Reload{
Period: 10 * time.Second,
Enabled: false,
},
}

debugf = logp.MakeDebug("cfgfile")
Expand All @@ -27,7 +29,11 @@ var (

type ReloadConfig struct {
// If path is a relative path, it is relative to the ${path.config}
Path string `config:"path"`
Path string `config:"path"`
Reload Reload `config:"reload"`
}

type Reload struct {
Period time.Duration `config:"period"`
Enabled bool `config:"enabled"`
}
Expand Down Expand Up @@ -86,7 +92,7 @@ func (rl *Reloader) Run(runnerFactory RunnerFactory) {
case <-rl.done:
logp.Info("Dynamic config reloader stopped")
return
case <-time.After(rl.config.Period):
case <-time.After(rl.config.Reload.Period):

debugf("Scan for new config files")
configReloads.Add(1)
Expand Down
6 changes: 3 additions & 3 deletions metricbeat/_meta/common.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

# Config reloading allows to dynamically load modules. Each file which is
# monitored must contain one or multiple modules as a list.
metricbeat.modules.reload:
metricbeat.config.modules:

# Glob pattern for configuration reloading
path: ${path.config}/conf.d/*.yml

# Period on which files under path should be checked for chagnes
period: 10s
reload.period: 10s

# Set to true to enable config reloading
enabled: false
reload.enabled: false
2 changes: 1 addition & 1 deletion metricbeat/beater/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import "github.com/elastic/beats/libbeat/common"
type Config struct {
// Modules is a list of module specific configuration data.
Modules []*common.Config `config:"modules"`
ReloadModules *common.Config `config:"reload.modules"`
ReloadModules *common.Config `config:"config.modules"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ The configuration in the main metricbeat.yml config file looks as following:

[source,yaml]
------------------------------------------------------------------------------
metricbeat.reload.modules:
enabled: true
metricbeat.config.modules:
path: configs/*.yml
period: 10s
reload.enabled: true
reload.period: 10s
------------------------------------------------------------------------------

A path with a glob must be defined on which files should be checked for changes. A period is set on how often
Expand Down
6 changes: 3 additions & 3 deletions metricbeat/metricbeat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

# Config reloading allows to dynamically load modules. Each file which is
# monitored must contain one or multiple modules as a list.
metricbeat.modules.reload:
metricbeat.config.modules:

# Glob pattern for configuration reloading
path: ${path.config}/conf.d/*.yml

# Period on which files under path should be checked for chagnes
period: 10s
reload.period: 10s

# Set to true to enable config reloading
enabled: false
reload.enabled: false

#========================== Modules configuration ============================
metricbeat.modules:
Expand Down
6 changes: 3 additions & 3 deletions metricbeat/tests/system/config/metricbeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ metricbeat.modules:
{%- endfor %}

{% if reload -%}
metricbeat.reload.modules:
metricbeat.config.modules:
path: {{ reload_path }}
period: 1s
enabled: true
reload.period: 1s
reload.enabled: true
{% endif -%}

#================================ General =====================================
Expand Down

0 comments on commit 21d875f

Please sign in to comment.