@@ -14,35 +14,16 @@ Returns search results for an <<eql,Event Query Language (EQL)>> query.
1414In {es}, EQL assumes each document in a data stream or index corresponds to an
1515event.
1616
17- ////
1817[source,console]
1918----
20- PUT /my-index-00001/_bulk?refresh
21- {"index":{ }}
22- { "@timestamp": "2020-12-06T11:04:05.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process", "id": "edwCRnyD", "sequence": 1 }, "process": { "name": "cmd.exe", "executable": "C:\\Windows\\System32\\cmd.exe" } }
23- {"index":{ }}
24- { "@timestamp": "2020-12-06T11:04:07.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "file", "id": "dGCHwoeS", "sequence": 2 }, "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", "executable": "C:\\Windows\\System32\\cmd.exe" } }
25- {"index":{ }}
26- { "@timestamp": "2020-12-07T11:06:07.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process", "id": "cMyt5SZ2", "sequence": 3 }, "process": { "name": "cmd.exe", "executable": "C:\\Windows\\System32\\cmd.exe" } }
27- {"index":{ }}
28- { "@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", "executable": "C:\\Windows\\System32\\cmd.exe" } }
29- {"index":{ }}
30- { "@timestamp": "2020-12-07T11:07:09.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process", "id": "aR3NWVOs", "sequence": 5 }, "process": { "name": "regsvr32.exe", "executable": "C:\\Windows\\System32\\regsvr32.exe" } }
31- {"index":{ }}
32- { "@timestamp": "2020-12-07T11:07:10.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process", "id": "GTSmSqgz0U", "sequence": 6, "type": "termination" }, "process": { "name": "regsvr32.exe", "executable": "C:\\Windows\\System32\\regsvr32.exe" } }
33- ----
34- // TESTSETUP
35- ////
36-
37- [source,console]
38- ----
39- GET /my-index-00001/_eql/search
19+ GET /my-index-000001/_eql/search
4020{
4121 "query": """
4222 process where process.name = "regsvr32.exe"
4323 """
4424}
4525----
26+ // TEST[setup:sec_logs]
4627
4728[[eql-search-api-request]]
4829==== {api-request-title}
@@ -54,12 +35,12 @@ GET /my-index-00001/_eql/search
5435[[eql-search-api-prereqs]]
5536==== {api-prereq-title}
5637
57- See <<eql-requirements,EQL requirements >>.
38+ See <<eql-required-fields >>.
5839
5940[[eql-search-api-limitations]]
6041===== Limitations
6142
62- See <<eql-limitations,EQL limitations>>.
43+ See <<eql-syntax- limitations,EQL limitations>>.
6344
6445[[eql-search-api-path-params]]
6546==== {api-path-parms-title}
@@ -163,6 +144,9 @@ Field containing the event classification, such as `process`, `file`, or
163144Defaults to `event.category`, as defined in the {ecs-ref}/ecs-event.html[Elastic
164145Common Schema (ECS)]. If a data stream or index does not contain the
165146`event.category` field, this value is required.
147+ +
148+ The event category field is typically mapped as a <<keyword,`keyword`>> or
149+ <<constant-keyword,constant keyword>> field.
166150
167151`fetch_size`::
168152(Optional, integer)
@@ -275,6 +259,9 @@ does not contain the `@timestamp` field, this value is required.
275259Events in the API response are sorted by this field's value, converted to
276260milliseconds since the https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in
277261ascending order.
262+
263+ The timestamp field is typically mapped as a <<date,`date`>> or
264+ <<date_nanos,`date_nanos`>> field.
278265--
279266
280267[[eql-search-api-wait-for-completion-timeout]]
@@ -506,17 +493,18 @@ The following EQL search request searches for events with an `event.category` of
506493`file` that meet the following conditions:
507494
508495* A `file.name` of `cmd.exe`
509- * An `agent.id ` other than `8a4f526c `
496+ * An `process.pid ` other than `2013 `
510497
511498[source,console]
512499----
513- GET /my-index-00001 /_eql/search
500+ GET /my-index-000001 /_eql/search
514501{
515502 "query": """
516- file where (file.name == "cmd.exe" and agent.id != "8a4f526c" )
503+ file where (file.name == "cmd.exe" and process.pid != 2013 )
517504 """
518505}
519506----
507+ // TEST[setup:sec_logs]
520508// TEST[s/search/search\?filter_path\=\-\*\.events\.\*fields/]
521509
522510The API returns the following response. Matching events in the `hits.events`
@@ -542,15 +530,12 @@ the events in ascending, lexicographic order.
542530 },
543531 "events": [
544532 {
545- "_index": "my-index-00001 ",
533+ "_index": "my-index-000001 ",
546534 "_type": "_doc",
547535 "_id": "fwGeywNsBl8Y9Ys1x51b",
548536 "_score": null,
549537 "_source": {
550538 "@timestamp": "2020-12-06T11:04:07.000Z",
551- "agent": {
552- "id": "8a4f500d"
553- },
554539 "event": {
555540 "category": "file",
556541 "id": "dGCHwoeS",
@@ -565,20 +550,18 @@ the events in ascending, lexicographic order.
565550 },
566551 "process": {
567552 "name": "cmd.exe",
568- "executable": "C:\\Windows\\System32\\cmd.exe"
553+ "executable": "C:\\Windows\\System32\\cmd.exe",
554+ "pid": 2012
569555 }
570556 }
571557 },
572558 {
573- "_index": "my-index-00001 ",
559+ "_index": "my-index-000001 ",
574560 "_type": "_doc",
575561 "_id": "AtOJ4UjUBAAx3XR5kcCM",
576562 "_score": null,
577563 "_source": {
578564 "@timestamp": "2020-12-07T11:07:08.000Z",
579- "agent": {
580- "id": "8a4f500d"
581- },
582565 "event": {
583566 "category": "file",
584567 "id": "bYA7gPay",
@@ -593,7 +576,8 @@ the events in ascending, lexicographic order.
593576 },
594577 "process": {
595578 "name": "cmd.exe",
596- "executable": "C:\\Windows\\System32\\cmd.exe"
579+ "executable": "C:\\Windows\\System32\\cmd.exe",
580+ "pid": 2012
597581 }
598582 }
599583 }
@@ -616,7 +600,7 @@ that:
616600--
617601* An `event.category` of `file`
618602* A `file.name` of `cmd.exe`
619- * An `agent.id ` other than `8a4f526c `
603+ * An `process.pid ` other than `2013 `
620604--
621605. Followed by an event with:
622606+
@@ -625,29 +609,24 @@ that:
625609* A `process.executable` that contains the substring `regsvr32`
626610--
627611
628- These events must also share the same `agent.id ` value.
612+ These events must also share the same `process.pid ` value.
629613
630614[source,console]
631615----
632- GET /my-index-00001 /_eql/search
616+ GET /my-index-000001 /_eql/search
633617{
634618 "query": """
635- sequence by agent.id
636- [ file where file.name == "cmd.exe" and agent.id != "8a4f526c" ]
619+ sequence by process.pid
620+ [ file where file.name == "cmd.exe" and process.pid != 2013 ]
637621 [ process where stringContains(process.executable, "regsvr32") ]
638622 """
639623}
640624----
625+ // TEST[setup:sec_logs]
641626
642- The API returns the following response. The `hits.sequences.join_keys` property
643- contains the shared `agent.id` value for each matching event. Matching events in
644- the `hits.sequences.events` property are sorted by
645- <<eql-search-api-timestamp-field,timestamp>>, converted to milliseconds since
646- the https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in ascending order.
647-
648- If two or more events share the same timestamp, the
649- <<eql-search-api-tiebreaker-field,`tiebreaker_field`>> field is used to sort
650- the events in ascending, lexicographic order.
627+ The API returns the following response. Matching sequences are included in the
628+ `hits.sequences` property. The `hits.sequences.join_keys` property contains the
629+ shared `process.pid` value for each matching event.
651630
652631[source,console-result]
653632----
@@ -664,11 +643,11 @@ the events in ascending, lexicographic order.
664643 "sequences": [
665644 {
666645 "join_keys": [
667- "8a4f500d "
646+ "2012 "
668647 ],
669648 "events": [
670649 {
671- "_index": "my-index-00001 ",
650+ "_index": "my-index-000001 ",
672651 "_type": "_doc",
673652 "_id": "AtOJ4UjUBAAx3XR5kcCM",
674653 "_version": 1,
@@ -677,9 +656,6 @@ the events in ascending, lexicographic order.
677656 "_score": null,
678657 "_source": {
679658 "@timestamp": "2020-12-07T11:07:08.000Z",
680- "agent": {
681- "id": "8a4f500d"
682- },
683659 "event": {
684660 "category": "file",
685661 "id": "bYA7gPay",
@@ -692,14 +668,15 @@ the events in ascending, lexicographic order.
692668 "type": "file",
693669 "size": 16384
694670 },
695- "process": {
671+ "process": {
696672 "name": "cmd.exe",
697- "executable": "C:\\Windows\\System32\\cmd.exe"
673+ "executable": "C:\\Windows\\System32\\cmd.exe",
674+ "pid": 2012
698675 }
699676 }
700677 },
701678 {
702- "_index": "my-index-00001 ",
679+ "_index": "my-index-000001 ",
703680 "_type": "_doc",
704681 "_id": "yDwnGIJouOYGBzP0ZE9n",
705682 "_version": 1,
@@ -708,17 +685,15 @@ the events in ascending, lexicographic order.
708685 "_score": null,
709686 "_source": {
710687 "@timestamp": "2020-12-07T11:07:09.000Z",
711- "agent": {
712- "id": "8a4f500d"
713- },
714688 "event": {
715689 "category": "process",
716690 "id": "aR3NWVOs",
717691 "sequence": 5
718692 },
719- "process": {
693+ "process": {
720694 "name": "regsvr32.exe",
721- "executable": "C:\\Windows\\System32\\regsvr32.exe"
695+ "executable": "C:\\Windows\\System32\\regsvr32.exe",
696+ "pid": 2012
722697 }
723698 }
724699 }
0 commit comments