java grok is return matched json as blank when one regex out of multple does not match.
Example
grok = Grok.create("patterns/patterns");
grok.compile("%{NUMBER:hits} %{USER:word}");
String s = "234\n";
Match gm = grok.match(s);
gm.captures();
System.out.println(gm.toJson());
in this case only %{NUMBER:hits} matches and not %{USER:word}. I expect java grok to return json {"hits":234} but it is returning {}.
java grok is return matched json as blank when one regex out of multple does not match. Example grok = Grok.create("patterns/patterns"); grok.compile("%{NUMBER:hits} %{USER:word}"); String s = "234\n"; Match gm = grok.match(s); gm.captures(); System.out.println(gm.toJson());
in this case only %{NUMBER:hits} matches and not %{USER:word}. I expect java grok to return json {"hits":234} but it is returning {}.