Github user ottobackwards commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2691#discussion_r187774270
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExtractGrok.java
---
@@ -80,18 +84,21 @@
public static final String FLOWFILE_ATTRIBUTE = "flowfile-attribute";
public static final String FLOWFILE_CONTENT = "flowfile-content";
private static final String APPLICATION_JSON = "application/json";
+ private static final String DEFAULT_PATTERN_NAME =
"/default-grok-patterns.txt";
public static final PropertyDescriptor GROK_EXPRESSION = new
PropertyDescriptor.Builder()
.name("Grok Expression")
- .description("Grok expression")
+ .description("Grok expression. If other Grok expressions are
referenced in this expression, they must be provided "
+ + "in the Grok Pattern File if set or exist in the default Grok
patterns")
.required(true)
- .addValidator(validateGrokExpression())
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
--- End diff --
I changed to the customValidate because the new grok no longer ignores
missing named patterns when compiling.
So if I had an expression %{FOO:foo}abc and tried to compile it without
providing the FOO pattern to the compiler it would silently eat the error in
the old version.
In the current version, it throws an illegal argument exception. So the
validation needs to utilize the provided pattern file, so I didn't think it
could be in Property validate. I thought it needed to be in the custom
validate, since it runs *after* all the regular validates.
Does that make sense?
---