Move to a modules.d layout#4537
Conversation
metricbeat/_meta/setup.yml
Outdated
There was a problem hiding this comment.
Perhaps comment this out so it's clear no reloading happens.
metricbeat/metricbeat.yml
Outdated
There was a problem hiding this comment.
I assume adding config options to this file still works?
There was a problem hiding this comment.
Yep, it should work as usual
metricbeat/metricbeat.yml
Outdated
There was a problem hiding this comment.
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.
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
There was a problem hiding this comment.
We have enabled in all except this one?
There was a problem hiding this comment.
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.
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
There was a problem hiding this comment.
Seems like this has now the short config header?
metricbeat/metricbeat.full.yml
Outdated
There was a problem hiding this comment.
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.
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.
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. |
| 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.
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.
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]
| } | ||
|
|
||
| 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.
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.
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.
Use var names []string (occurs in a few places).
| metricbeat.modules: | ||
| - module: apache | ||
| metricsets: ["status"] | ||
| enabled: false |
|
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.dfolder, 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:
modulessubcommand only works with default layout, user can still break that by manually adding modules to the yaml, or disablingmetricbeat.config.modules.pathTODO: