-
Notifications
You must be signed in to change notification settings - Fork 215
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
Truncate Processor: Add support to truncate all fields in an event #4317
Conversation
Signed-off-by: Krishna Kondaka <[email protected]>
final int startIndex = entry.getStartAt() == null ? 0 : entry.getStartAt(); | ||
final Integer length = entry.getLength(); | ||
if (truncateWhen != null && !expressionEvaluator.evaluateConditional(truncateWhen, recordEvent)) { | ||
continue; | ||
} | ||
boolean truncateAll = false; | ||
for (String sourceKey : sourceKeys) { | ||
if (sourceKey.equals("*")) { |
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.
This seems like we may be introducing a concept that could cause confusion. What if we change the behavior of source_keys
to not require any input and make the default be all fields?
…l keys Signed-off-by: Krishna Kondaka <[email protected]>
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! One minor comment below:
@@ -26,14 +24,18 @@ public static class Entry { | |||
@JsonProperty("length") | |||
private Integer length; | |||
|
|||
@JsonProperty("do_recursively") |
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.
This seems a bit verbose, maybe "recursive" is clear enough?
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.
@oeyh , I like that suggestion.
Signed-off-by: Krishna Kondaka <[email protected]>
…4317) Truncate Processor: Add support to truncate all fields in an event Signed-off-by: Krishna Kondaka <[email protected]> Co-authored-by: Krishna Kondaka <[email protected]> (cherry picked from commit 8a7132d)
…4317) (#4326) Truncate Processor: Add support to truncate all fields in an event Signed-off-by: Krishna Kondaka <[email protected]> Co-authored-by: Krishna Kondaka <[email protected]> (cherry picked from commit 8a7132d) Co-authored-by: Krishna Kondaka <[email protected]>
Description
Supports truncating all fields in an event when
source_keys
is not specified or null.The config would look like this to truncate all fields to a length of 5 characters.
Also, added support to do truncation recursively in case of nested objects with config option
Issues Resolved
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.