Java Grok is simple API that allows you to easily parse logs and other files (single line). With Java Grok, you can turn unstructured log and event data into structured data (JSON).
- reporting errors and other patterns from logs and processes
- parsing complex text output and converting it to json for external processing
- apply 'write-once use-everywhere' to regular expressions
- automatically providing patterns for unknown text inputs (logs you want patterns generated for future matching)
Usage (Grok java documentation)
Include Java Grok into your java project and use it like:
Grok g = new Grok();
g.addPatternFromFile(/path/to/pattern);
g.compile("%{URI}");
Match gm = g.match(yourlog);
gm.captures();
//See the result
System.out.println(gm.toJson());
<dependency>
<groupId>com.nflabs</groupId>
<artifactId>grok</artifactId>
<version>0.0.5</version>
</dependency>
Java Grok support Maven and Gradle
- Maven
mvn package. - Gradle
gradle build, If you dont have gradle installed you can use./gradlew build.
Maintainer: @anthonycorbacho
Any contributions are warmly welcome

