diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index f8099efc79e9..579544d6e0c6 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -82,6 +82,7 @@ https://github.com/elastic/beats/compare/v5.0.1...master[Check the HEAD diff] - Reset all states ttl on startup to make sure it is overwritten by new config {pull}2840[2840] - Persist all states for files which fall under ignore_older to have consistent behaviour {pull}2859[2859] - Improve shutdown behaviour with large number of files. {pull}3035[3035] +- Add enabled config option to prospectors. *Winlogbeat* diff --git a/filebeat/_meta/beat.full.yml b/filebeat/_meta/beat.full.yml index 265d4627773c..7de2e6522201 100644 --- a/filebeat/_meta/beat.full.yml +++ b/filebeat/_meta/beat.full.yml @@ -205,6 +205,9 @@ filebeat.prospectors: # Note: Potential data loss. Make sure to read and understand the docs for this option. #close_timeout: 0 + # Defines if prospectors is enabled + #enabled: true + #----------------------------- Stdin prospector ------------------------------- # Configuration to use stdin input #- input_type: stdin diff --git a/filebeat/crawler/crawler.go b/filebeat/crawler/crawler.go index 902ff74080d7..7729c25497aa 100644 --- a/filebeat/crawler/crawler.go +++ b/filebeat/crawler/crawler.go @@ -40,7 +40,9 @@ func (c *Crawler) Start(states file.States, once bool) error { if err != nil { return fmt.Errorf("Error in initing prospector: %s", err) } - c.prospectors = append(c.prospectors, prospector) + if prospector.IsEnabled() { + c.prospectors = append(c.prospectors, prospector) + } } logp.Info("Loading Prospectors completed. Number of prospectors: %v", len(c.prospectors)) diff --git a/filebeat/docs/reference/configuration/filebeat-options.asciidoc b/filebeat/docs/reference/configuration/filebeat-options.asciidoc index 7b40996ad18e..8910fcdb1c38 100644 --- a/filebeat/docs/reference/configuration/filebeat-options.asciidoc +++ b/filebeat/docs/reference/configuration/filebeat-options.asciidoc @@ -462,6 +462,10 @@ Currently if a new harvester can be started again, the harvester is picked rando This configuration option applies per prospector. You can use this option to indirectly set higher priorities on certain prospectors by assigning a higher limit of harvesters. +===== enabled + +The `enabled` option can be used with each prospector to define if a prospector is enabled or not. By default, enabled is set to true. + [[configuration-global-options]] === Filebeat Global Configuration diff --git a/filebeat/filebeat.full.yml b/filebeat/filebeat.full.yml index 7eab33f1493a..4fec95ecadf1 100644 --- a/filebeat/filebeat.full.yml +++ b/filebeat/filebeat.full.yml @@ -205,6 +205,9 @@ filebeat.prospectors: # Note: Potential data loss. Make sure to read and understand the docs for this option. #close_timeout: 0 + # Defines if prospectors is enabled + #enabled: true + #----------------------------- Stdin prospector ------------------------------- # Configuration to use stdin input #- input_type: stdin diff --git a/filebeat/prospector/config.go b/filebeat/prospector/config.go index c73b28d4cbf3..1c0e8156319d 100644 --- a/filebeat/prospector/config.go +++ b/filebeat/prospector/config.go @@ -10,6 +10,7 @@ import ( var ( defaultConfig = prospectorConfig{ + Enabled: true, IgnoreOlder: 0, ScanFrequency: 10 * time.Second, InputType: cfg.DefaultInputType, @@ -22,6 +23,7 @@ var ( ) type prospectorConfig struct { + Enabled bool `config:"enabled"` ExcludeFiles []*regexp.Regexp `config:"exclude_files"` IgnoreOlder time.Duration `config:"ignore_older"` Paths []string `config:"paths"` diff --git a/filebeat/prospector/prospector.go b/filebeat/prospector/prospector.go index bb4d7c7707bd..93277430b043 100644 --- a/filebeat/prospector/prospector.go +++ b/filebeat/prospector/prospector.go @@ -158,6 +158,11 @@ func (p *Prospector) Run(once bool) { } } +// IsEnabled returns true if the prospector is eanbled +func (p *Prospector) IsEnabled() bool { + return p.config.Enabled +} + // updateState updates the prospector state and forwards the event to the spooler // All state updates done by the prospector itself are synchronous to make sure not states are overwritten func (p *Prospector) updateState(event *input.Event) error {