|
@@ -32,6 +32,8 @@ PUT /sec_logs/_bulk?refresh
|
|
|
{ "@timestamp": "2020-12-07T11:07:08.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "file", "id": "bYA7gPay", "sequence": 4 }, "file": { "accessed": "2020-12-07T11:07:08.000Z", "name": "cmd.exe", "path": "C:\\Windows\\System32\\cmd.exe", "type": "file", "size": 16384 }, "process": { "name": "cmd.exe", "path": "C:\\Windows\\System32\\cmd.exe" } }
|
|
|
{"index":{"_index" : "sec_logs", "_id" : "5"}}
|
|
|
{ "@timestamp": "2020-12-07T11:07:09.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process", "id": "aR3NWVOs", "sequence": 5 }, "process": { "name": "regsvr32.exe", "path": "C:\\Windows\\System32\\regsvr32.exe" } }
|
|
|
+{"index":{"_index" : "sec_logs", "_id" : "6"}}
|
|
|
+{ "@timestamp": "2020-12-07T11:07:10.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process", "id": "GTSmSqgz0U", "sequence": 6, "type": "termination" }, "process": { "name": "regsvr32.exe", "path": "C:\\Windows\\System32\\regsvr32.exe" } }
|
|
|
----
|
|
|
// TESTSETUP
|
|
|
|
|
@@ -100,7 +102,7 @@ https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in ascending order.
|
|
|
"name": "cmd.exe",
|
|
|
"path": "C:\\Windows\\System32\\cmd.exe"
|
|
|
}
|
|
|
- },
|
|
|
+ },
|
|
|
"sort": [
|
|
|
1607252645000
|
|
|
]
|
|
@@ -390,6 +392,27 @@ contains the shared `agent.id` value for each matching event.
|
|
|
}
|
|
|
----
|
|
|
// TESTRESPONSE[s/"took": 60/"took": $body.took/]
|
|
|
+
|
|
|
+You can use the <<eql-until-keyword,`until` keyword>> to specify an expiration
|
|
|
+event for sequences. Matching sequences must end before this event.
|
|
|
+
|
|
|
+The following request adds
|
|
|
+`until [ process where event.type == "termination" ]` to the previous EQL query.
|
|
|
+This ensures matching sequences end before a process termination event.
|
|
|
+
|
|
|
+[source,console]
|
|
|
+----
|
|
|
+GET /sec_logs/_eql/search
|
|
|
+{
|
|
|
+ "query": """
|
|
|
+ sequence by agent.id with maxspan=1h
|
|
|
+ [ file where file.name == "cmd.exe" ]
|
|
|
+ [ process where stringContains(process.name, "regsvr32") ]
|
|
|
+ until [ process where event.type == "termination" ]
|
|
|
+ """
|
|
|
+}
|
|
|
+----
|
|
|
+// TEST[s/search/search\?filter_path\=\-\*\.sequences\.\*events\.\*fields/]
|
|
|
====
|
|
|
|
|
|
[discrete]
|
|
@@ -548,7 +571,7 @@ tiebreaker for events with the same timestamp.
|
|
|
}
|
|
|
----
|
|
|
// TESTRESPONSE[s/"took": 34/"took": $body.took/]
|
|
|
-<1> The event's <<eql-search-api-timestamp-field,timestamp>>, converted to
|
|
|
+<1> The event's <<eql-search-api-timestamp-field,timestamp>>, converted to
|
|
|
milliseconds since the https://en.wikipedia.org/wiki/Unix_time[Unix
|
|
|
epoch]
|
|
|
<2> The event's `event.id` value.
|