Skip to content

Instantly share code, notes, and snippets.

@FCO
Created Feb 19, 2020
Embed
What would you like to do?
{ "timestamp" : "2020-01-01T00:00:00.000000Z", "type" : "request", "method" : "GET", "path" : "/", "req-id" : "0000", "status" : 200 }
{ "timestamp" : "2020-01-01T00:01:00.000000Z", "type" : "request", "method" : "GET", "path" : "/abc", "req-id" : "0000", "status" : 200 }
{ "timestamp" : "2020-01-01T00:02:00.000000Z", "type" : "request", "method" : "GET", "path" : "/login", "req-id" : "1234", "status" : 200 }
{ "timestamp" : "2020-01-01T00:03:00.000000Z", "type" : "request", "method" : "GET", "path" : "/", "req-id" : "0000", "status" : 200 }
{ "timestamp" : "2020-01-01T00:04:00.000000Z", "type" : "request", "method" : "GET", "path" : "/", "req-id" : "0000", "status" : 200 }
{ "timestamp" : "2020-01-01T00:05:00.000000Z", "type" : "request", "method" : "POST", "path" : "/login", "req-id" : "1234", "status" : 200, "session-id" : "xyz" }
{ "timestamp" : "2020-01-01T00:06:00.000000Z", "type" : "request", "method" : "GET", "path" : "/", "req-id" : "0000", "status" : 200 }
event request { has $method, $path, $status, $req-id, $timestamp }
event login {
has $session-id = #post.session-id;
has $get-time = #get.timestamp;
has $post-time = #post.timestamp;
match {
request(#get , method == "GET" , path == "/login", status == 200)
request(#post, method == "POST", path == "/login", status == 200, req-id == #get.req-id)
}
}
$ bin/eel -l=events.log examples/login
{"post-time":"2020-01-01T00:05:00.000000Z","timestamp":"2020-02-19T17:02:48.362834Z","type":"login","session-id":"xyz","get-time":"2020-01-01T00:02:00.000000Z"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment