Skip to content
This repository was archived by the owner on Jun 2, 2022. It is now read-only.

Commit 9cfab64

Browse files
Add to grok matcher more input informations
1 parent 3f99e96 commit 9cfab64

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.nflabs</groupId>
66
<artifactId>Grok</artifactId>
7-
<version>0.0.1-SNAPSHOT</version>
7+
<version>0.0.2-SNAPSHOT</version>
88
<packaging>jar</packaging>
99
<name>Grok</name>
1010
<url>http://maven.apache.org</url>

src/main/java/com/nflabs/Grok/Grok.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public Match match( String text ){
155155
match.match = m;
156156
match.start = m.start(0);
157157
match.end = m.end(0);
158+
match.line = text;
158159
return match;
159160
}
160161
return match;

src/main/java/com/nflabs/Grok/Match.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class Match {
1616
public Matcher match; //regex matcher
1717
public int start; //offset
1818
public int end; //offset end
19+
public String line; //source
1920
public Garbage garbage;
2021

2122
private String _subject; //texte
@@ -67,8 +68,9 @@ public int captures(){
6768
if( this.match == null )
6869
return GrokError.GROK_ERROR_UNINITIALIZED;
6970

71+
_capture.put("LINE", this.line);
72+
_capture.put("LENGTH", this.line.length() +"");
7073
Map<String, String> mappedw = this.match.namedGroups();
71-
//System.out.println(mappedw);
7274
Iterator<Entry<String, String>> it = mappedw.entrySet().iterator();
7375
while (it.hasNext()) {
7476

0 commit comments

Comments
 (0)