diff --git a/data-prepper-plugins/mutate-string-processors/README.md b/data-prepper-plugins/mutate-string-processors/README.md index 82d731ea27..8d72eebc87 100644 --- a/data-prepper-plugins/mutate-string-processors/README.md +++ b/data-prepper-plugins/mutate-string-processors/README.md @@ -88,7 +88,7 @@ If `from` substring does not have a match, the key will be returned as it is. ### Configuration * `entries` - (required) - A list of entries to add to an event * `source` - (required) - The key to be modified - * `from` - (required) - The substring to be replaced. This cannot be regex. + * `from` - (required) - The substring to be replaced. This doesn't support regex. * `to` - (required) - The String to be substituted for each match of `from` --- diff --git a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/ReplaceStringProcessor.java b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/ReplaceStringProcessor.java index adf3ec9f23..15ec8615db 100644 --- a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/ReplaceStringProcessor.java +++ b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/ReplaceStringProcessor.java @@ -30,10 +30,10 @@ public ReplaceStringProcessor(final PluginMetrics pluginMetrics, final ReplaceSt this.expressionEvaluator = expressionEvaluator; for(final ReplaceStringProcessorConfig.Entry entry : config.getEntries()) { - if (entry.getSubstituteWhen() != null - && !expressionEvaluator.isValidExpressionStatement(entry.getSubstituteWhen())) { + if (entry.getReplaceWhen() != null + && !expressionEvaluator.isValidExpressionStatement(entry.getReplaceWhen())) { throw new InvalidPluginConfigurationException( - String.format("substitute_when %s is not a valid expression statement. See https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/ for valid expression syntax", entry.getSubstituteWhen())); + String.format("substitute_when %s is not a valid expression statement. See https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/ for valid expression syntax", entry.getReplaceWhen())); } } } @@ -41,7 +41,7 @@ public ReplaceStringProcessor(final PluginMetrics pluginMetrics, final ReplaceSt @Override protected void performKeyAction(final Event recordEvent, final ReplaceStringProcessorConfig.Entry entry, final String value) { - if (Objects.nonNull(entry.getSubstituteWhen()) && !expressionEvaluator.evaluateConditional(entry.getSubstituteWhen(), recordEvent)) { + if (Objects.nonNull(entry.getReplaceWhen()) && !expressionEvaluator.evaluateConditional(entry.getReplaceWhen(), recordEvent)) { return; } diff --git a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/ReplaceStringProcessorConfig.java b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/ReplaceStringProcessorConfig.java index 091f3ab0c1..6d049910fb 100644 --- a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/ReplaceStringProcessorConfig.java +++ b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/ReplaceStringProcessorConfig.java @@ -22,14 +22,14 @@ public static class Entry { private EventKey source; @JsonPropertyDescription("The substring to be replaced in the source.") private String from; - @JsonPropertyDescription("The string to be substituted for each match of `from`.") + @JsonPropertyDescription("The string to be replaced for each match of `from`.") private String to; - @JsonProperty("substitute_when") + @JsonProperty("replace_when") @JsonPropertyDescription("A Data Prepper [conditional expression](https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/), " + "such as `/some-key == \"test\"'`, that will be evaluated to determine whether the processor will be " + "run on the event. Default is `null`. All events will be processed unless otherwise stated.") - private String substituteWhen; + private String replaceWhen; public EventKey getSource() { return source; @@ -43,13 +43,13 @@ public String getTo() { return to; } - public String getSubstituteWhen() { return substituteWhen; } + public String getReplaceWhen() { return replaceWhen; } - public Entry(final EventKey source, final String from, final String to, final String substituteWhen) { + public Entry(final EventKey source, final String from, final String to, final String replaceWhen) { this.source = source; this.from = from; this.to = to; - this.substituteWhen = substituteWhen; + this.replaceWhen = replaceWhen; } public Entry() {}