-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Move to a modules.d layout #4537
Conversation
metricbeat/_meta/setup.yml
Outdated
reload.enabled: false | ||
|
||
# Period on which files under path should be checked for changes | ||
reload.period: 10s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps comment this out so it's clear no reloading happens.
metricbeat/metricbeat.yml
Outdated
@@ -6,37 +6,17 @@ | |||
# | |||
# You can find the full configuration reference here: | |||
# https://www.elastic.co/guide/en/beats/metricbeat/index.html | |||
|
|||
#========================== Modules configuration ============================ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume adding config options to this file still works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it should work as usual
metricbeat/metricbeat.yml
Outdated
|
||
metricbeat.config.modules: | ||
# Glob pattern for configuration loading | ||
path: ${path.config}/modules.d/*.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The part I worry here is that it becomes easier to break the getting started. Before getting started was 2 files: Binary + Basic config. Now a directory with the correct path + a one more config file are needed. Don't have a better solution here, just want to raise that point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess most people use downloaded packages or tar.gz, everything will be on those.
For the scripted case, old config formats should still work. I don't see this becoming an issue but you never know, it's a good point
@@ -0,0 +1,3 @@ | |||
- module: audit | |||
metricsets: ["kernel"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have enabled in all except this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it didn't have the enabled: false
before, this makes me think I can remove enabled
from all of them, so we don't have 2 visible ways to disable (rename file vs changing field)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove it. The problem is that the same file is also used for the docs where it is probably nice to have it.
metricbeat/metricbeat.full.yml
Outdated
# This file is a full configuration example documenting all non-deprecated | ||
# options in comments. For a shorter configuration example, that contains only | ||
# the most common options, please see metricbeat.yml in the same directory. | ||
# This file is an example configuration file highlighting only the most common |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this has now the short config header?
metricbeat/metricbeat.full.yml
Outdated
@@ -1,470 +1,28 @@ | |||
########################## Metricbeat Configuration ########################### | |||
###################### Metricbeat Configuration Example ####################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to the full config? As now each module is separate, should the config there directly contain the full config and only have 1 version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I broke something here, will fix it :)
2130c5c
to
374dc2c
Compare
Thinking out loud: Looking at apache an alternative approach would be to have 2 directories, one with the enabled configs as symlinks and the other with all inside. So if you enable a module, it writes a symlink to the enabled directory. Not sure if this one is better, but the advantage is that "only" a symlink to a file has to be created an no files renamed which feels more intrusive to me. But also symlinks have it's problem cross platform. I like that in the current current implementation the pattern for enabled / disabled can be configured as far as I understand. I was first thinking if we could also play around with the What happens in the current implementation if there is a config file with a module inside that has |
Yeah, symlink-ing is problematic on Windows. Playing with the current approach, I think it's intuitive enough. Some thoughts and concerns:
I think we should discuss this over zoom :) |
40840a0
to
5601f0b
Compare
Working on filebeat support, once #4566 it should be trivial to add it here |
fcd3b90
to
4c9330e
Compare
jenkins package it |
6cf46a3
to
1fadb98
Compare
jenkins package it |
jenkins retest it |
Packaging job passed: http://build-eu-00.elastic.co/job/beats-package-PR/112/, will need to do manual testing on them |
jenkins package it please |
I think the redis config file is missing? |
It's missing indeed, in master too: https://github.com/elastic/beats/tree/master/filebeat/module/redis/_meta |
jenkins package it |
@@ -0,0 +1,16 @@ | |||
#- module: nginx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all these should be un-commented? Otherwise they are not really enabled.
I tried starting filebeat after enabling the
|
As we moved them into modules.d, they won't be enabled until the file is renamed
This was the behavior already for prospectors, the issue is that dynamic config loading (from *.yml files) is done by the Perhaps that can go in a follow up PR, WDYT? |
Yeah, absolutely, it can come in a different PR. |
@exekias I get an error when running without Elasticsearch available. Filebeat should start even if ES is not available, and just wait for it. This regression might have been introduced in #4566, but we should fix it for beta1.
|
@@ -93,6 +95,29 @@ def test_reload_writes_pipeline(self): | |||
for key in self.es.transport.perform_request("GET", "/_ingest/pipeline/").keys())) | |||
proc.check_kill_and_wait() | |||
|
|||
def test_no_es_connection(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see a test on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to avoid tripping twice over the same stone 😸
filebeat/Makefile
Outdated
@cp ${ES_BEATS}/filebeat/_meta/common.reference.p1.yml _meta/beat.reference.yml | ||
@${PYTHON_ENV}/bin/python ${ES_BEATS}/script/config_collector.py --beat ${BEAT_NAME} --full $(PWD) >> _meta/beat.reference.yml | ||
@cat ${ES_BEATS}/filebeat/_meta/common.reference.p1.yml > _meta/beat.reference.yml | ||
@. ${PYTHON_ENV}/bin/activate; python ${ES_BEATS}/script/config_collector.py --beat ${BEAT_NAME} --full $(PWD) >> _meta/beat.reference.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to activate the virtual environment? I thought you could invoke ${PYTHON_ENV}/bin/python
because it's directly running a script (and it's slightly faster)? [virtualenv activate docs]
filebeat/cmd/modules.go
Outdated
} | ||
|
||
if !strings.HasSuffix(glob, ".yml") { | ||
return nil, errors.Errorf("wrong settings for config.modules.path, it is expected to end with *.yml. Got: %s", glob) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm taking the error too literally, but the check is for .yml
and the error says it must end with *.yml
which is a disconnect.
libbeat/cfgfile/glob_manager.go
Outdated
} | ||
|
||
func (g *GlobManager) load() error { | ||
g.files = []*cfgfile{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not initialize this to an empty slice. I've found it's best to not distinguish between empty and nil slices. https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
libbeat/cfgfile/glob_manager.go
Outdated
|
||
// ListEnabled conf files | ||
func (g *GlobManager) ListEnabled() []string { | ||
names := []string{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use var names []string
(occurs in a few places).
@@ -34,7 +34,6 @@ in <<configuration-metricbeat>>. Here is an example configuration: | |||
metricbeat.modules: | |||
- module: apache | |||
metricsets: ["status"] | |||
enabled: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call 👍
LGTM. |
Thank you for the review @andrewkroh!, I think I addressed all comments |
jenkins retest this |
Removed needs_docs label because we should be covered with the CLI changes plus the additions for modules.d in #4973 |
This PR moves module settings into a
modules.d
folder, and adds a helper command to list/enable/disable them both in filebeat and metricbeat. Final layout for metricbeat looks like this:And it's managed like this:
Some caveats:
modules
subcommand only works with default layout, user can still break that by manually adding modules to the yaml, or disablingmetricbeat.config.modules.path
TODO: