ExtractGrok - Include exception message when compile fails

This closes: #1845

Signed-off-by: Andre F de Miranda <trixpan@users.noreply.github.com>
This commit is contained in:
Pierre Villard 2017-05-23 20:27:22 +02:00 committed by Andre F de Miranda
parent 3966f5ce86
commit 80dfe0257f
1 changed files with 2 additions and 9 deletions

View File

@ -255,19 +255,12 @@ public class ExtractGrok extends AbstractProcessor {
Grok grok = new Grok(); Grok grok = new Grok();
try { try {
grok.compile(input); grok.compile(input);
} catch (GrokException e) { } catch (GrokException | java.util.regex.PatternSyntaxException e) {
return new ValidationResult.Builder() return new ValidationResult.Builder()
.subject(subject) .subject(subject)
.input(input) .input(input)
.valid(false) .valid(false)
.explanation("Not a valid Grok Expression") .explanation("Not a valid Grok Expression - " + e.getMessage())
.build();
} catch (java.util.regex.PatternSyntaxException e) {
return new ValidationResult.Builder()
.subject(subject)
.input(input)
.valid(false)
.explanation("Not a valid Grok Expression")
.build(); .build();
} }