diff --git a/libs/grok/src/main/resources/patterns/java b/libs/grok/src/main/resources/patterns/java index e968006ad2d20..01766b8ebd165 100644 --- a/libs/grok/src/main/resources/patterns/java +++ b/libs/grok/src/main/resources/patterns/java @@ -7,8 +7,6 @@ JAVAMETHOD (?:()|[a-zA-Z$_][a-zA-Z$_0-9]*) JAVASTACKTRACEPART %{SPACE}at %{JAVACLASS:class}\.%{JAVAMETHOD:method}\(%{JAVAFILE:file}(?::%{NUMBER:line})?\) # Java Logs JAVATHREAD (?:[A-Z]{2}-Processor[\d]+) -JAVACLASS (?:[a-zA-Z0-9-]+\.)+[A-Za-z0-9$]+ -JAVAFILE (?:[A-Za-z0-9_.-]+) JAVASTACKTRACEPART at %{JAVACLASS:class}\.%{WORD:method}\(%{JAVAFILE:file}:%{NUMBER:line}\) JAVALOGMESSAGE (.*) # MMM dd, yyyy HH:mm:ss eg: Jan 9, 2014 7:13:13 AM diff --git a/libs/grok/src/test/java/org/elasticsearch/grok/GrokTests.java b/libs/grok/src/test/java/org/elasticsearch/grok/GrokTests.java index f9d2055de1b36..0193811a20d0a 100644 --- a/libs/grok/src/test/java/org/elasticsearch/grok/GrokTests.java +++ b/libs/grok/src/test/java/org/elasticsearch/grok/GrokTests.java @@ -477,6 +477,16 @@ public void testUnsupportedBracketsInFieldName() { assertNull(matches); } + public void testJavaClassPatternWithUnderscore() { + Grok grok = new Grok(basePatterns, "%{JAVACLASS}"); + assertThat(grok.match("Test_Class.class"), is(true)); + } + + public void testJavaFilePatternWithSpaces() { + Grok grok = new Grok(basePatterns, "%{JAVAFILE}"); + assertThat(grok.match("Test Class.java"), is(true)); + } + private void assertGrokedField(String fieldName) { String line = "foo"; Grok grok = new Grok(basePatterns, "%{WORD:" + fieldName + "}");