This repository has been archived by the owner on Mar 21, 2023. It is now read-only.
add optional prefix/suffix to set_fields functions #75
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
40 changes: 40 additions & 0 deletions
40
src/test/resources/org/graylog/plugins/pipelineprocessor/functions/fieldPrefixSuffix.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
rule "prefixsuffix" | ||
when true | ||
then | ||
// plain set field | ||
set_field("field", "1"); | ||
// both prefix and suffix, doesn't touch the above | ||
set_field("field", "2", "prae_", "_sueff"); | ||
|
||
// combinations of optional prefix, suffix | ||
set_field(field: "field", value: "3", suffix: "_sueff"); | ||
set_field(field: "field", value: "4", prefix: "prae_"); | ||
|
||
// set multiple fields with the same prefix | ||
set_fields( | ||
fields: { | ||
field1: "5", | ||
field2: "6" | ||
}, | ||
prefix: "pre_", | ||
suffix: "_suff" | ||
); | ||
|
||
// set multiple fields with the same prefix, suffix optional | ||
set_fields( | ||
fields: { | ||
field1: "7", | ||
field2: "8" | ||
}, | ||
prefix: "pre_" | ||
); | ||
// set multiple fields with the same suffix, prefix optional | ||
set_fields( | ||
fields: { | ||
field1: "9", | ||
field2: "10" | ||
}, | ||
suffix: "_suff" | ||
); | ||
end | ||
|
This file contains 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
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.
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.
Are the named values required now?
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.
They are only if we want to set the optional
message
parameter. Leaving that out you can also omit the parameter namesPrefix and Suffix are "in between" the positional params, the parser does not yet try to match the parameter types.