use java.time for time

This commit is contained in:
2016-12-10 08:16:55 +01:00
parent 256b278428
commit a409c4c5d0
23 changed files with 466 additions and 196 deletions

5
recommind-logs/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
/bin/
/test-output/
/.settings/
/.classpath
/.project

View File

@@ -0,0 +1,6 @@
dependencies {
compile project(':performanceDb')
compile "io.thekraken:grok:0.1.5"
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}