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 7c1b473c6b3a1..b1cc608a5ca2d 100644 --- a/libs/grok/src/test/java/org/elasticsearch/grok/GrokTests.java +++ b/libs/grok/src/test/java/org/elasticsearch/grok/GrokTests.java @@ -446,6 +446,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 + "}");