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

Cherry-pick #7352 to 6.3: Fix duplication of dynamic fields on reconnect #7417

Merged
merged 1 commit into from
Jun 27, 2018

Conversation

ruflin
Copy link
Contributor

@ruflin ruflin commented Jun 26, 2018

Cherry-pick of PR #7352 to 6.3 branch. Original message:

If setup.template.overwrite: true is set the template is overwritten each time the Beat reconnects. The dynamicTemplates are a global variable that keeps state. This had the side effect that each time the template was generated for loading, the dynamic fields were append again. The logic in the code is changed now that each time when the template is generated first the dynamicFields array is reset.

This also works with the new append_fields config option because it is read during the load process to also potentially add dynamic fields.

The same applies to the default fields which are global. Also this array is reset. As default_fields were only used for Elasticsearch 7.0 is does not need an entry in the changelog.

If possible in the future both variables should be part of the template object instead of being global. Unfortunately this would required major changes.

* Fix duplication of dynamic fields on reconnect

If `setup.template.overwrite: true` is set the template is overwritten each time the Beat reconnects. The `dynamicTemplates` are a global variable that keeps state. This had the side effect that each time the template was generated for loading, the dynamic fields were append again. The logic in the code is changed now that each time when the template is generated first the dynamicFields array is reset.

This also works with the new `append_fields` config option because it is read during the load process to also potentially add dynamic fields.

The same applies to the default fields which are global. Also this array is reset. As default_fields were only used for Elasticsearch 7.0 is does not need an entry in the changelog.

If possible in the future both variables should be part of the template object instead of being global. Unfortunately this would required major changes.

(cherry picked from commit df74c26)
@exekias exekias merged commit f4b481a into elastic:6.3 Jun 27, 2018
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…c#7417)

* Fix duplication of dynamic fields on reconnect

If `setup.template.overwrite: true` is set the template is overwritten each time the Beat reconnects. The `dynamicTemplates` are a global variable that keeps state. This had the side effect that each time the template was generated for loading, the dynamic fields were append again. The logic in the code is changed now that each time when the template is generated first the dynamicFields array is reset.

This also works with the new `append_fields` config option because it is read during the load process to also potentially add dynamic fields.

The same applies to the default fields which are global. Also this array is reset. As default_fields were only used for Elasticsearch 7.0 is does not need an entry in the changelog.

If possible in the future both variables should be part of the template object instead of being global. Unfortunately this would required major changes.

(cherry picked from commit b0a52be)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants