-
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
Generate configuration from mage for all Beats #12618
Generate configuration from mage for all Beats #12618
Conversation
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.
LGTM — tested that nothing broken from a Stack Monitoring metricsets/filesets config generation POV. Nice change!
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.
LGTM, only a last small detail
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.
Lovely 👍, no more cat
+ sed
+ bash
+ make
magic.
b1205f1
to
61de1b5
Compare
Co-Authored-By: Jaime Soriano Pastor <[email protected]>
61de1b5
to
aaea913
Compare
Failing tests are unrelated. |
From now on all Beats use `mage` when generating configuration files. This comes with the following changes: * Heartbeat does not use `post_process_config.py` to modify processors, instead it is added using the templating * Functionbeat does not include unsupported outputs * All Beats can alter the common configuration coming from `libbeat`. ### What does it mean for Community Beats? When adopting this version of `libbeat`, you need to make sure that you have a target named `Config` in your `magefile.go`. An example target which generates a sample configuration, a reference configuration and a Docker configuration from `{yourbeat}/_meta/beat.yml` and the common configuration from `libbeat` is the following: ```golang import devtools "github.com/elastic/beats/dev-tools/mage" func Config() error { return devtools.Config(devtools.AllConfigTypes, devtools.ConfigFileParams{}, ".") } ``` If the configuration of your Beat consists of multiple files, you can pass your own instance of `ConfigFileParams`: ```golang func ConfigFileParams() devtools.ConfigFileParams { return devtools.ConfigFileParams{ ShortParts: []string{ devtools.OSSBeatDir("_meta/beat.yml"), devtools.OSSBeatDir("_meta/beat.custom.yml"), devtools.LibbeatDir("_meta/config.yml.tmpl"), }, ReferenceParts: []string{ devtools.OSSBeatDir("_meta/beat.reference.yml"), devtools.OSSBeatDir("_meta/beat.custom.referenceyml"), devtools.LibbeatDir("_meta/config.reference.yml.tmpl"), }, DockerParts: []string{ devtools.OSSBeatDir("_meta/beat.docker.yml"), devtools.LibbeatDir("_meta/config.docker.yml"), }, } } ``` It is also possible to pass variables to the templates using the `ExtraVars` attribute of `ConfigFileParams` struct.
From now on all Beats use
mage
when generating configuration files. This comes with the following changes:post_process_config.py
to modify processors, instead it is added using the templatinglibbeat
.What does it mean for Community Beats?
When adopting this version of
libbeat
, you need to make sure that you have a target namedConfig
in yourmagefile.go
. An example target which generates a sample configuration, a reference configuration and a Docker configuration from{yourbeat}/_meta/beat.yml
and the common configuration fromlibbeat
is the following:If the configuration of your Beat consists of multiple files, you can pass your own instance of
ConfigFileParams
:It is also possible to pass variables to the templates using the
ExtraVars
attribute ofConfigFileParams
struct.