-
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
[Enhancement][libbeat] Add append processor #33364
Conversation
💚 CLA has been signed |
This pull request doesn't have a |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
79197aa
to
020214a
Compare
libbeat/processors/actions/append.go
Outdated
if err != nil { | ||
f.logger.Debugf("could not fetch value for key: %s. all the values will be appended in a new key %s.", target, target) | ||
} else { | ||
arr = append(arr, val) |
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.
Do we need to check the type of val
here? I'm thinking we need to do the same as line 117 below.
Either way, it would be nice to add a test where target already exists as both a scalar and a list.
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 don't think a type check is required. as the event.GetValue
returns interface{}
and we will have to append if it's a scaler. We just have to iterate in case of a list. Hance the type check on L117.
Let me know if you think otherwise. 🤔
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.
You were right. I have added a type check in this line to avoid appending and array inside an array.
<titleabbrev>append_processor</titleabbrev> | ||
++++ | ||
|
||
The `append_processor` processor appends static values and values from the listed fields to target field. |
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.
Can you expand description so it is like the append
ingest node processor? I think we want to behavior of these two append
implementations to be the same.
https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html
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.
Actually, I have that particular processor in mind while developing this one. I'll update the description in this one though.
PS. could you please let me know if I'm missing any other doc file? CHANGELOG or any other? I'm unaware of the doc files that needed to be changed for libbeat. 😅
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.
Looks good.
Just needs an entry in CHANGELOG.next.asciidoc
in the Added
section for all beats.
Hey @leehinman - Added a changelog entry let me know if anything else is required. 😄 |
Will this also be added into Filebeat so Filebeat users can implement it? |
Hey @mr1716 - It will be accessible in all the Beats. So yes, you'll be able to use it in Filebeat. |
@vinit-chauhan thanks. I dont see the documentation for the append processor here: https://www.elastic.co/guide/en/beats/filebeat/current/filtering-and-enhancing-data.html Does that need to be updated to reflect this new processor? |
Hey @mr1716 - it is available in the @leehinman can you or anyone from your team confirm if the change would be part of 8.7.0? moreover, can we backport it to 8.6.0? |
@vinit-chauhan Thanks/ Much appreciated. It says that it is a part of all beats for 8.6. So if it isnt, there might need to be a change in the release notes as it isnt there for filebeat. |
Hey @mr1716 you are right, for some reason code is not part of 8.6.0 and I'm not sure why?! I believe someone from elastic team might be able to answer it better. |
The merge didn't happen before feature freeze for 8.6.0, so that is why it isn't there. It will be part of 8.7.0. |
@leehinman If that's the case, the document should be updated accordingly |
Add append processor that matches the behavior of the elasticsearch ingest node append processor
Type of change
What does this PR do?
This PR here is to add the
append
processor in thelibbeat
. using this processor users will be able to append values from either a field or static values to either an existing or a new target key in the response.The code will get 3 parameters
target_field
,fields
andvalues
. And It will append the values of each field listed under thefields
section and then it will append all the values listed under thevalues
key.If the target_key is an existing key with values, It will be appended in an array first.
Why is it important?
As a user I will be able to append values to a field using beats processors.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs