Add replace_fields config option in add_host_metadata for replacing host fields#20490
Add replace_fields config option in add_host_metadata for replacing host fields#20490kaiyan-sheng merged 12 commits intoelastic:masterfrom kaiyan-sheng:host_name
Conversation
|
Pinging @elastic/integrations-platforms (Team:Platforms) |
|
@jsoriano I consider this is a breaking change. Is it ok to add this in next release? |
@kaiyan-sheng I agree that this is a breaking change, but it seems needed for the inventory efforts, and I think that for the cases we will be breaking it will be more a fix than a breaking change 🙂 Apart of "breaking" the case of Something else we can do to mitigate possible problems is to add a We can also add, in the note you are adding in |
Hmm not what I can think of. I will post it here if I see any other case.
Good point! I added My thought is, we can keep it default as true right now to match the previous/original behavior and then switch the default to false in 8.0.
Done. Thank you! |
Ok, let's avoid making it a breaking change by now, we can still reconsider this before 7.10. I was convinced that it was better to make the breaking change, and I still think it would be for Metricbeat now that we are adding more logic in modules for the host inventory. But then I have thought on Filebeat and I am not so sure. There are probably SIEM use cases where log parsing is adding host information, but additional network information is still wanted. And also, we are adding this processor by default in the Kubernetes manifests for Filebeat. Btw (naming is complicated), I find having |
Done.
Done, yeah I was thinking |
jsoriano
left a comment
There was a problem hiding this comment.
LGTM, added some nitpicking comments.
We can decide to make it a breaking change later.
|
Merging this PR. If we decide to change |
| return false | ||
| } | ||
|
|
||
| hostFieldsMap := hostFields.(common.MapStr) |
There was a problem hiding this comment.
This will panic if the host is not a common.MapStr. Since Beats like Filebeat can handle arbitrary data it should be defensive (for example see
Lines 207 to 216 in 95626b8
There was a problem hiding this comment.
Thanks @andrewkroh for pointing this out! I will create a separate PR to fix this issue.
…ost fields (elastic#20490) * add replace_host_fields config param
What does this PR do?
This PR adds
replace_fieldsconfig option inadd_host_metadatafor replacing host fields. By default,replace_fieldsequals totrueto make sure this PR is not a breaking change.Why is it important?
We are adding common host fields into several modules in Metricbeat, such as
host.idandhost.name. Butadd_host_metadataprocessor would overwritehost.idfield without this PR.Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.How to test this PR locally
This PR should work for any module/metricset. I'm using aws module as an example here:
awsmodule by./metricbeat modules enable awsawsconfigmodules.d/aws.ymlto:metricbeat.yml,add_host_metadataprocessor is enabled andreplace_fieldsis set tofalse:./metricbeat -ehost.*fields only fromec2metricset but not any fields fromadd_host_metadatasuch ashost.hostname,host.architecture,host.os.*etc.Related issues
#20464