-
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
Loading external fields.yml
files
#11199
Conversation
libbeat/asset/support.go
Outdated
paths []string | ||
} | ||
|
||
func DefaultSupport(log *logp.Logger, beat string, cfg *common.Config) (Supporter, error) { |
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.
exported function DefaultSupport should have comment or be unexported
e2aac89
to
4c147ae
Compare
paths []string | ||
} | ||
|
||
func DefaultSupport(log *logp.Logger, beat string, cfg *common.Config) (Supporter, error) { |
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.
exported function DefaultSupport should have comment or be unexported
730fb9d
to
7c37a28
Compare
7c37a28
to
564d098
Compare
@@ -867,6 +867,10 @@ output.elasticsearch: | |||
#- name: field_name | |||
# type: field_type | |||
|
|||
# List of external fields.yml files to load. | |||
#setup.template.external_fields: | |||
#- /path/to/external/fields.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.
To me the name kind of clashes with setup.template.fields
. Like: which one has priority, does one replace the other, are the two files combined, why not have setup.template.fields accept a list of files.
@@ -77,6 +77,8 @@ type Beat struct { | |||
Config beatConfig | |||
RawConfig *common.Config // Raw config that can be unpacked to get Beat specific config data. | |||
|
|||
Mapping mapping.Supporter // Get all fields of the Beat |
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 so wish I hadn't named it 'Supporter' :)
if err != nil { | ||
return err | ||
} | ||
m := b.index.Manager(esClient, idxmgmt.BeatsAssets(fields)) |
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 'BeatsAssets' has been a place-holder, due to not having some better options availble. I'd be in favor of passing a more rich interface instead of a raw blob to be parsed and interpreted somewhere else.
If possible we want to be able to install multiple templates in the future, each with it's own set of fields. A more generic type better being integrated with the index manager would be helpful.
The index manager is supposed to be the only component/interface Beats should use for configuring and preparing indices (facade pattern). Maybe we can move the fields/templating support inside the index manager?
Closing because this PR is outdated and we are moving towards integration in the long run. |
This pull request does not have a backport label. Could you fix it @kvch? 🙏
NOTE: |
This pull request doesn't have a |
A new option
external_fields
is added tosetup.template
to let users specify their own fields.yml files in addition to the default fields or the one configured insetup.template.fields
.Previously, fields collection from fields and configuration was done in multiple places in the codebase. This lead to inconsistencies when loading the template when loading dashboards. This PR moves the process to a single place. It still contains a few hacks, as I do not want to introduce any breaking change in the configuration.
The ideal configuration would be the following:
This could be used when loading the template and dashboards.
I compromised to add the new option to
setup.template
, as fields settings are required by the template. I introduced a newasset.Supporter
which collect fields from the configuration insetup.template
. This supporter is able to pass the correct fields list to both template loading and dashboard loading. I moved adding extra fields inappend_fields
from template loading, so these fields are not missing when dashboards are loaded.Loading JSON templates correctly when loading template and dashboards is not in the scope of this PR.
New
fields.yml
loading processLoading of fields is changed to the following process.
setup.template.fields
setup.template.external_fields
.setup.template.append_fields
.Fixes
From now on it is possible to load custom template into ES when loading dashboards. It means that users can load their own dashboards with user defined fields using a Beat.
TODO
Depends on #11198