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 #13914 to 7.4: Field registry: Don't overwrite fields with same name #14037

Merged
merged 1 commit into from
Oct 14, 2019

Conversation

adriansr
Copy link
Contributor

Cherry-pick of PR #13914 to 7.4 branch. Original message:

When fields are registered (fields.go, autogenerated), they are grouped by (Beatname, Name and Priority). Currently, if the same triplet is used more than once, the previous asset is overwritten. This causes the internal template inside the Beat to lose fields, and its hard to detect because the generated fields.yml contains all the fields.

This is the case with Filebeat inputs and modules sharing the same name:

module/netflow/fields.go:

asset.SetFields("filebeat", "netflow", asset.ModuleFieldsPri, AssetNetflow)

input/netflow/fields.go:

asset.SetFields("filebeat", "netflow", asset.ModuleFieldsPri, AssetNetflow)

Also this introduces an inconsistence as the order of registration can vary, so a build might or might not have the fields depending on the order the packages are built.

Fixes #13768

When fields are registered (fields.go, autogenerated), they are grouped
by (Beatname, Name and Priority). Currently, if the same triplet is used
more than once, the previous asset is overwritten.

This is the case with Filebeat inputs and modules sharing the same name:

module/netflow/fields.go:
  asset.SetFields("filebeat", "netflow", asset.ModuleFieldsPri, AssetNetflow)

input/netflow/fields.go:
  asset.SetFields("filebeat", "netflow", asset.ModuleFieldsPri, AssetNetflow)

Also this introduces an inconsistence as the order of registration can
vary.

Fixes elastic#13768

(cherry picked from commit 4be5efe)
@adriansr adriansr merged commit 96f20f9 into elastic:7.4 Oct 14, 2019
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…elastic#14037)

When fields are registered (fields.go, autogenerated), they are grouped
by (Beatname, Name and Priority). Currently, if the same triplet is used
more than once, the previous asset is overwritten.

This is the case with Filebeat inputs and modules sharing the same name:

module/netflow/fields.go:
  asset.SetFields("filebeat", "netflow", asset.ModuleFieldsPri, AssetNetflow)

input/netflow/fields.go:
  asset.SetFields("filebeat", "netflow", asset.ModuleFieldsPri, AssetNetflow)

Also this introduces an inconsistence as the order of registration can
vary.

Fixes elastic#13768

(cherry picked from commit 5fec6bc)
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