When I use the additional prospectors function and reload function, the reload function is not working.
Filebeat read the additional prospector configurations in the config.FetchConfigs, which call the mergeConfigFiles.
In the mergeConfigFiles, the code is :
tmpConfig := struct {
Filebeat Config
}{}
err := cfgfile.Read(&tmpConfig, file)
if err != nil {
return fmt.Errorf("Failed to read %s: %s", file, err)
}
config.Prospectors = append(config.Prospectors, tmpConfig.Filebeat.Prospectors...)
The structure decides that the additional.yml should be :
filebeat.prospectors:
- input_type: log
paths:- d:\temp\test\log\test1*.log
- input_type: log
paths:- d:\temp\test\log\test2*.log
I find that it doesn't working. I do the debug and check the libbeat/cfgfile/reload.go, and find a doubt.
First, the watcher is OK, filebeat can catch the change of the file.
Second, when the reloader read the yml file, return empty.
check the code in cfgfile.Run:
// Load all config objects
configs := []*common.Config{}
for _, file := range files {
c, err := LoadList(file)
if err != nil {
logp.Err("Error loading config: %s", err)
continue
}
configs = append(configs, c...)
}
debugf("Number of module configs found: %v", len(configs))
The structure []*common.Config{} require the yml like this:
- input_type: log
paths:- d:\temp\test\log\test1*.log
- input_type: log
paths:- d:\temp\test\log\test2*.log
Because of the filebeat.prospectors, it can't get anything.
Please help me to check the issue.
If I do something wrong, please tell me. Thanks.
By the way, if only use the main filebeat.yml. the reload also doesn't work because of it can't get the configurations.