Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Preserve the order of log format in capture
  • Loading branch information
SivaMaplelabs committed Sep 27, 2018
commit 3e03ae02ab54d03a6471f300ebcd3bf0a76bbf16
6 changes: 3 additions & 3 deletions src/main/java/io/krakens/grok/api/Match.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -61,7 +61,7 @@ public int getEnd() {
public void setKeepEmptyCaptures(boolean ignore) {
// clear any cached captures
if ( capture.size() > 0) {
capture = new HashMap<>();
capture = new LinkedHashMap<>();
}
this.keepEmptyCaptures = ignore;
}
Expand Down Expand Up @@ -122,7 +122,7 @@ private Map<String, Object> capture(boolean flattened ) throws GrokException {
return capture;
}

capture = new HashMap<>();
capture = new LinkedHashMap<>();

// _capture.put("LINE", this.line);
// _capture.put("LENGTH", this.line.length() +"");
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/krakens/grok/api/CaptureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void test002_captureMathodMulti() throws GrokException {
assertEquals(2, map.size());
assertEquals("Hello", map.get("foo"));
assertEquals("World", map.get("bar"));
assertEquals("{bar=World, foo=Hello}", map.toString());
assertEquals("{foo=Hello, bar=World}", map.toString());
}

@Test
Expand All @@ -69,7 +69,7 @@ public void test003_captureMathodNasted() throws GrokException {
assertEquals(2, map.size());
assertEquals("Hello World", map.get("foo"));
assertEquals("World", map.get("bar"));
assertEquals("{bar=World, foo=Hello World}", map.toString());
assertEquals("{foo=Hello World, bar=World}", map.toString());
}

@Test
Expand Down