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

Commit 98ef5c3

Browse files
update grok
1 parent 7063e2e commit 98ef5c3

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

patterns/base

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ URIPATH (?:/[A-Za-z0-9$.+!*'(),~:#%_-]*)+|(?:\?[A-Za-z0-9$.+!*'(),~#%&/=:;_-]*)
5454
URIPARAM \?[A-Za-z0-9$.+!*'(),~#%&/=:;_-]*
5555
URIPATHPARAM %{URIPATH}(?:%{URIPARAM})?
5656
#URI %{URIPROTO:proto}://(?:%{USER:sur}(?::[^@]*)?@)?(?:%{URIHOST:host})?(?:%{URIPATHPARAM:params})?
57-
URI %{URIPROTO:proto}://(?:%{USER:sur}(?::[^@]*)?@)?(?:%{URIHOST:host})?(?:%{DATAS:params})?
57+
URI %{URIPROTO:proto}://(?:%{USER:UNWANTED}(?::[^@]*)?@)?(?:%{URIHOST:host})?(?:%{DATAS:params})?
5858

5959
############
6060
# DATE
@@ -109,8 +109,12 @@ QS %{QUOTEDSTRING}
109109
# LOGFORMAT SAMPLE
110110
############
111111
SYSLOGBASE %{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}:
112-
APACHE %{IP} - - \[%{HTTPDATE:timestamp}\] %{QS:query} %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QS:Referer} %{QS:agent}
113-
#drwxr-xr-x+ 46 anthonyC staff 1564 Dec 27 12:02 .
112+
113+
APACHE (?:%{APACHE_FULL}|%{APACHE_LIGHT})
114+
APACHE_2 %{IP} %{USER:hyphen} %{USER:user} \[%{HTTPDATE:timestamp}\] %{QUOTEDSTRING:query} %{NUMBER:response} (?:%{NUMBER:bytes}|-)(?: %{QUOTEDSTRING:Referer} %{QUOTEDSTRING:agent})?
115+
APACHE_FULL %{IP} %{USER:hyphen} %{USER:user} \[%{HTTPDATE:timestamp}\] %{QUOTEDSTRING:query} %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QUOTEDSTRING:Referer} %{QUOTEDSTRING:agent}
116+
APACHE_LIGHT %{IP} %{USER:hyphen} %{USER:user} \[%{HTTPDATE:timestamp}\] %{QUOTEDSTRING:query} %{NUMBER:response} (?:%{NUMBER:bytes}|-)
117+
114118
DIRECTORYCONTNENT %{DATA:permission}%{SPACE:UNWANTED}%{INT:size}%{SPACE:UNWANTED}%{USER}%{SPACE:UNWANTED}%{USER:Group}%{SPACE:UNWANTED}%{INT:molla}%{SPACE:UNWANTED}%{MONTH}%{SPACE:UNWANTED}%{MONTHDAY}%{SPACE:UNWANTED}%{HOUR}:%{MINUTE}%{SPACE:UNWANTED}%{GREEDYDATA:fileorfolder}
115119
# Log Levels
116120
LOGLEVEL ([T|t]race|TRACE|[D|d]ebug|DEBUG|[N|n]otice|NOTICE|[I|i]nfo|INFO|[W|w]arn?(?:ing)?|WARN?(?:ING)?|[E|e]rr?(?:or)?|ERR?(?:OR)?|[C|c]rit?(?:ical)?|CRIT?(?:ICAL)?|[F|f]atal|FATAL|[S|s]evere|SEVERE)

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.3-SNAPSHOT</version>
7+
<version>0.0.3.1-SNAPSHOT</version>
88
<packaging>jar</packaging>
99
<name>Grok</name>
1010
<url>http://maven.apache.org</url>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import com.google.code.regexp.Matcher;
1010
import com.google.gson.Gson;
11+
import com.google.gson.GsonBuilder;
1112
import com.nflabs.Grok.Grok;
1213

1314
public class Match {
@@ -123,7 +124,7 @@ public String toJson(){
123124
return null;
124125

125126
this.cleanMap();
126-
Gson gs = new Gson();
127+
Gson gs = new GsonBuilder().setPrettyPrinting().create();;//new Gson();
127128
return gs.toJson(/*cleanMap(*/_capture/*)*/);
128129

129130
}

src/test/java/com/nflabs/Grok/GrokTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public void testGrok() throws Throwable{
2828
Match gm = g.match("64.242.88.10 - - [07/Mar/2004:16:05:49 -0800] \"GET /twiki/bin/edit/Main/Double_bounce_sender?topicparent=Main.ConfigurationVariables HTTP/1.1\" 401 12846 ");
2929
gm.captures();
3030
System.out.println(gm.toJson());
31-
32-
31+
32+
3333
//lol
3434
/*g.compile("%{URI}");
3535
@@ -44,4 +44,4 @@ public void testGrok() throws Throwable{
4444
assertEquals(null, map.get("port"));
4545
assertEquals("/search=lol", map.get("params"));*/
4646
}
47-
}
47+
}

0 commit comments

Comments
 (0)