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

Doc: Clarify where input settings should be placed when using filebeat.config.inputs #19148

Closed
ppf2 opened this issue Jun 11, 2020 · 4 comments
Closed
Assignees
Labels
docs Filebeat Filebeat Team:Services (Deprecated) Label for the former Integrations-Services team

Comments

@ppf2
Copy link
Member

ppf2 commented Jun 11, 2020

6.8.9

When using external config files, it is unclear what input settings are actually allowed under the filebeat.config.inputs construct. For example, if the user configures clean_inactive under filebeat.config.inputs, it does not throw a configuration error and treats it as a valid config, but it doesn't appear to apply to the inputs that are configured within the external files.

filebeat.config.inputs:
  enabled: true
  path: prospectors/*.yml
  clean_inactive: 24h

Specifying these settings within the external configuration files work. While the example on this page does show that scan_frequency is configured as part of the input block, because we are accepting these settings at the filebeat.config.inputs level, it will be helpful to clarify that these settings must all go into the external files, etc..

@ppf2 ppf2 added docs Filebeat Filebeat labels Jun 11, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 11, 2020
@andresrc andresrc added the Team:Services (Deprecated) Label for the former Integrations-Services team label Jun 15, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jun 15, 2020
@ycombinator
Copy link
Contributor

I looked through the Filebeat code, specifically this path:

  1. err = crawler.Start(fb.pipeline, config.ConfigInput, config.ConfigModules)
  2. if configInputs.Enabled() {
    c.inputReloader = cfgfile.NewReloader(pipeline, configInputs)
    if err := c.inputReloader.Check(c.inputsFactory); err != nil {
    return fmt.Errorf("creating input reloader failed: %+v", err)
    }
    }
    .
  3. // NewReloader creates new Reloader instance for the given config
    func NewReloader(pipeline beat.PipelineConnector, cfg *common.Config) *Reloader {
    config := DefaultDynamicConfig
    cfg.Unpack(&config)
    path := config.Path
    if !filepath.IsAbs(path) {
    path = paths.Resolve(paths.Config, path)
    }
    return &Reloader{
    pipeline: pipeline,
    config: config,
    path: path,
    done: make(chan struct{}),
    }
    }
  4. // DefaultDynamicConfig provides default behavior for a Runner.
    DefaultDynamicConfig = DynamicConfig{
    Reload: Reload{
    Period: 10 * time.Second,
    Enabled: false,
    },
    }
  5. // DynamicConfig loads config files from a given path, allowing to reload new changes
    // while running the beat
    type DynamicConfig struct {
    // If path is a relative path, it is relative to the ${path.config}
    Path string `config:"path"`
    Reload Reload `config:"reload"`
    }
  6. // Check configs are valid (only if reload is disabled)
    func (rl *Reloader) Check(runnerFactory RunnerFactory) error {
    // If config reload is enabled we ignore errors (as they may be fixed afterwards)
    if rl.config.Reload.Enabled {
    return nil
    }
    debugf("Checking module configs from: %s", rl.path)
    gw := NewGlobWatcher(rl.path)
    files, _, err := gw.Scan()
    if err != nil {
    return errors.Wrap(err, "fetching config files")
    }
    // Load all config objects
    configs, err := rl.loadConfigs(files)
    if err != nil {
    return errors.Wrap(err, "loading configs")
    }
    debugf("Number of module configs found: %v", len(configs))
    // Initialize modules
    for _, c := range configs {
    // Only add configs to startList which are enabled
    if !c.Config.Enabled() {
    continue
    }
    if err = runnerFactory.CheckConfig(c.Config); err != nil {
    return err
    }
    }
    return nil
    }

According to the code, we are not expecting any input settings to be specified directly under filebeat.config.inputs. They must be specified under each input defined in the external input configuration files. +1 to clarifying this in the documentation.

ppf2 added a commit that referenced this issue Jun 18, 2020
Clarify that all input type configuration options must be specified within the external configuration file: #19148
@ppf2
Copy link
Member Author

ppf2 commented Jun 18, 2020

Thanks for confirming! Submitted a PR to clarify documentation until we start validating configuration settings for Beats.

dedemorton pushed a commit that referenced this issue Oct 3, 2020
Clarify that all input type configuration options must be specified within the external configuration file: #19148
dedemorton pushed a commit to dedemorton/beats that referenced this issue Oct 3, 2020
Clarify that all input type configuration options must be specified within the external configuration file: elastic#19148
@dedemorton
Copy link
Contributor

Closed by #19284

dedemorton pushed a commit to dedemorton/beats that referenced this issue Oct 3, 2020
Clarify that all input type configuration options must be specified within the external configuration file: elastic#19148
dedemorton added a commit that referenced this issue Oct 5, 2020
Clarify that all input type configuration options must be specified within the external configuration file: #19148

Co-authored-by: Pius <[email protected]>
dedemorton added a commit that referenced this issue Oct 5, 2020
Clarify that all input type configuration options must be specified within the external configuration file: #19148

Co-authored-by: Pius <[email protected]>
leweafan pushed a commit to leweafan/beats that referenced this issue Apr 28, 2023
Clarify that all input type configuration options must be specified within the external configuration file: elastic#19148

Co-authored-by: Pius <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Filebeat Filebeat Team:Services (Deprecated) Label for the former Integrations-Services team
Projects
None yet
Development

No branches or pull requests

5 participants