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

Disable command line flags for module reloading #5381

Merged
merged 1 commit into from
Oct 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di
*Filebeat*

- Fix default paths for redis 4.0.1 logs on macOS {pull}5173[5173]
- Fix Filebeat not starting if command line and modules configs are used together. {issue}5376[5376]

*Heartbeat*

Expand Down
2 changes: 1 addition & 1 deletion filebeat/beater/filebeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func New(b *beat.Beat, rawConfig *common.Config) (beat.Beater, error) {
return nil, err
}

moduleRegistry, err := fileset.NewModuleRegistry(config.Modules, b.Info.Version)
moduleRegistry, err := fileset.NewModuleRegistry(config.Modules, b.Info.Version, true)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion filebeat/fileset/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewFactory(outlet channel.Factory, registrar *registrar.Registrar, beatVers
// Create creates a module based on a config
func (f *Factory) Create(c *common.Config) (cfgfile.Runner, error) {
// Start a registry of one module:
m, err := NewModuleRegistry([]*common.Config{c}, f.beatVersion)
m, err := NewModuleRegistry([]*common.Config{c}, f.beatVersion, false)
if err != nil {
return nil, err
}
Expand Down
14 changes: 10 additions & 4 deletions filebeat/fileset/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func newModuleRegistry(modulesPath string,
}

// NewModuleRegistry reads and loads the configured module into the registry.
func NewModuleRegistry(moduleConfigs []*common.Config, beatVersion string) (*ModuleRegistry, error) {
func NewModuleRegistry(moduleConfigs []*common.Config, beatVersion string, init bool) (*ModuleRegistry, error) {
modulesPath := paths.Resolve(paths.Home, "module")

stat, err := os.Stat(modulesPath)
Expand All @@ -96,9 +96,13 @@ func NewModuleRegistry(moduleConfigs []*common.Config, beatVersion string) (*Mod
return &ModuleRegistry{}, nil // empty registry, no error
}

modulesCLIList, modulesOverrides, err := getModulesCLIConfig()
if err != nil {
return nil, err
var modulesCLIList []string
var modulesOverrides *ModuleOverrides
if init {
modulesCLIList, modulesOverrides, err = getModulesCLIConfig()
if err != nil {
return nil, err
}
}
mcfgs := []*ModuleConfig{}
for _, moduleConfig := range moduleConfigs {
Expand All @@ -108,7 +112,9 @@ func NewModuleRegistry(moduleConfigs []*common.Config, beatVersion string) (*Mod
}
mcfgs = append(mcfgs, mcfg)
}

mcfgs, err = appendWithoutDuplicates(mcfgs, modulesCLIList)

if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion filebeat/fileset/modules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func TestMissingModuleFolder(t *testing.T) {
load(t, map[string]interface{}{"module": "nginx"}),
}

reg, err := NewModuleRegistry(configs, "5.2.0")
reg, err := NewModuleRegistry(configs, "5.2.0", true)
assert.NoError(t, err)
assert.NotNil(t, reg)

Expand Down