Make it possible to chain Beat processors in the script processor#11680
Merged
andrewkroh merged 2 commits intoelastic:masterfrom Apr 10, 2019
Merged
Conversation
ph
approved these changes
Apr 8, 2019
Contributor
ph
left a comment
There was a problem hiding this comment.
@andrewkroh LGTM, do you want to add support for the new truncate and copy field in another PR?
Member
Author
There was a problem hiding this comment.
Yes, I'll add them and expose their constructors. I'm not really happy about having this list but until I come up with a better way to reuse the existing processor registry this works.
Member
Author
There was a problem hiding this comment.
Constructors for copy_fields and truncate_fields are now exposed.
Prior to this change it was possible to construct individual Beat processors. This adds the ability
to chain them together in a list so that calling a single `Run(event)` function executes the list of
processors.
var localeProcessor = new processor.AddLocale();
var chain = new processor.Chain()
.Add(localeProcessor)
.Rename({
fields: [
{from: "event.timezone", to: "timezone"},
],
})
.Add(function(evt) {
evt.Put("hello", "world");
})
.Build();
function process(evt) {
return chain.Run(evt);
}
2297f93 to
06cdb0b
Compare
ph
approved these changes
Apr 9, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior to this change it was possible to construct individual Beat processors. This adds the ability
to chain them together in a list so that calling a single
Run(event)function executes the list ofprocessors.