use java.time for time
This commit is contained in:
5
recommind-logs/.gitignore
vendored
Normal file
5
recommind-logs/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/bin/
|
||||
/test-output/
|
||||
/.settings/
|
||||
/.classpath
|
||||
/.project
|
||||
6
recommind-logs/build.gradle
Normal file
6
recommind-logs/build.gradle
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
dependencies {
|
||||
compile project(':performanceDb')
|
||||
compile "io.thekraken:grok:0.1.5"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.lucares.recommind.logs;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.lucares.performance.db.Entry;
|
||||
|
||||
import io.thekraken.grok.api.Grok;
|
||||
import io.thekraken.grok.api.Match;
|
||||
|
||||
public class LogReader implements Iterable<Entry> {
|
||||
|
||||
private final Grok grok;
|
||||
|
||||
public LogReader(final Grok grok) {
|
||||
super();
|
||||
this.grok = grok;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Entry> iterator() {
|
||||
|
||||
// Grok grok = Grok.create("patterns/patterns");
|
||||
|
||||
/** Grok pattern to compile, here httpd logs */
|
||||
// grok.compile("%{COMBINEDAPACHELOG}");
|
||||
|
||||
/** Line of log to match */
|
||||
final String log = "112.169.19.192 - - [06/Mar/2013:01:36:30 +0900] \"GET / HTTP/1.1\" 200 44346 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22\"";
|
||||
|
||||
final Match gm = grok.match(log);
|
||||
gm.captures();
|
||||
gm.toMap();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.lucares.recommind.logs;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
|
||||
import org.lucares.performance.db.Entry;
|
||||
import org.lucares.performance.db.PerformanceDb;
|
||||
import org.lucares.performance.db.Tags;
|
||||
|
||||
public class PerformanceLogs {
|
||||
|
||||
public void ingest(final PerformanceDb db, final File performanceLog, final Tags tags) {
|
||||
|
||||
final ArrayBlockingQueue<Entry> queue = new ArrayBlockingQueue<>(10);
|
||||
|
||||
db.put(queue, tags);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user