Skip to content

Commit e3d3c34

Browse files
committed
[DOCS] Update EQL default event category and timestamp values (#53102)
Updates the documented default `event_category_field` and `timestamp_field` values for the EQL search API. Also updates related guidance in the EQL requirement docs. Relates to #53073.
1 parent 0c4bf64 commit e3d3c34

File tree

2 files changed

+46
-22
lines changed

2 files changed

+46
-22
lines changed

docs/reference/eql/requirements.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ In {es}, EQL assumes each document in an index corresponds to an event.
2727
To search an index using EQL, each document in the index must contain the
2828
following field archetypes:
2929

30-
Event type::
30+
Event category::
3131
A field containing the event classification, such as `process`, `file`, or
3232
`network`. This is typically mapped as a <<keyword,`keyword`>> field.
3333

docs/reference/eql/search.asciidoc

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ The following <<docs-bulk,bulk API>> request adds some example log data to the
1717
----
1818
PUT sec_logs/_bulk?refresh
1919
{"index":{"_index" : "sec_logs", "_id" : "1"}}
20-
{ "@timestamp": "2020-12-07T11:06:07.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process" }, "process": { "name": "cmd.exe", "path": "C:\\Windows\\System32\\cmd.exe" } }
20+
{ "@timestamp": "2020-12-06T11:04:05.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process" }, "process": { "name": "cmd.exe", "path": "C:\\Windows\\System32\\cmd.exe" } }
2121
{"index":{"_index" : "sec_logs", "_id" : "2"}}
22-
{ "@timestamp": "2020-12-07T11:07:08.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "file" }, "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" } }
22+
{ "@timestamp": "2020-12-06T11:04:07.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "file" }, "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" } }
2323
{"index":{"_index" : "sec_logs", "_id" : "3"}}
24+
{ "@timestamp": "2020-12-07T11:06:07.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process" }, "process": { "name": "cmd.exe", "path": "C:\\Windows\\System32\\cmd.exe" } }
25+
{"index":{"_index" : "sec_logs", "_id" : "4"}}
26+
{ "@timestamp": "2020-12-07T11:07:08.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "file" }, "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" } }
27+
{"index":{"_index" : "sec_logs", "_id" : "5"}}
2428
{ "@timestamp": "2020-12-07T11:07:09.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process" }, "process": { "name": "regsvr32.exe", "path": "C:\\Windows\\System32\\regsvr32.exe" } }
2529
----
2630
// TESTSETUP
@@ -35,27 +39,28 @@ specified in the `query` parameter. The EQL query matches events with an
3539
----
3640
GET sec_logs/_eql/search
3741
{
38-
"event_category_field": "event.category",
39-
"timestamp_field": "@timestamp",
4042
"query": """
4143
process where process.name == "cmd.exe"
4244
"""
4345
}
4446
----
4547

4648
Because the `sec_log` index follows the ECS, you don't need to specify the
47-
timestamp field. The request uses the `@timestamp` field by default.
49+
required <<eql-required-fields,event category or timestamp>> fields. The request
50+
uses the `event.category` and `@timestamp` fields by default.
4851

49-
The API returns the following response containing the matching event:
52+
The API returns the following response containing the matching events. Events
53+
in the response are sorted by timestamp, converted to milliseconds since the
54+
https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in ascending order.
5055

5156
[source,console-result]
5257
----
5358
{
54-
"took": 3,
59+
"took": 60,
5560
"timed_out": false,
5661
"hits": {
5762
"total": {
58-
"value": 1,
63+
"value": 2,
5964
"relation": "eq"
6065
},
6166
"events": [
@@ -64,6 +69,27 @@ The API returns the following response containing the matching event:
6469
"_type": "_doc",
6570
"_id": "1",
6671
"_score": null,
72+
"_source": {
73+
"@timestamp": "2020-12-06T11:04:05.000Z",
74+
"agent": {
75+
"id": "8a4f500d"
76+
},
77+
"event": {
78+
"category": "process"
79+
},
80+
"process": {
81+
"name": "cmd.exe",
82+
"path": "C:\\Windows\\System32\\cmd.exe"
83+
}
84+
},
85+
"sort": [
86+
1607252645000
87+
]
88+
},
89+
{
90+
"_index": "sec_logs",
91+
"_id": "3",
92+
"_score": null,
6793
"_source": {
6894
"@timestamp": "2020-12-07T11:06:07.000Z",
6995
"agent": {
@@ -77,31 +103,32 @@ The API returns the following response containing the matching event:
77103
"path": "C:\\Windows\\System32\\cmd.exe"
78104
}
79105
},
80-
"sort" : [1607339167000]
106+
"sort": [
107+
1607339167000
108+
]
81109
}
82110
]
83111
}
84112
}
85113
----
86-
// TESTRESPONSE[s/"took": 3/"took": $body.took/]
114+
// TESTRESPONSE[s/"took": 60/"took": $body.took/]
87115

88116
[discrete]
89-
[[eql-search-specify-event-type-field]]
90-
=== Specify an event type field
117+
[[eql-search-specify-event-category-field]]
118+
=== Specify an event category field
91119

92-
The EQL search API uses `event.category` as the required <<eql-required-fields,event
93-
category field>> by default. You can use the `event_category_field` parameter to specify
94-
another event category field.
120+
The EQL search API uses `event.category` as the required
121+
<<eql-required-fields,event category field>> by default. You can use the
122+
`event_category_field` parameter to specify another event category field.
95123

96-
For example, the following request specifies `file.type` as the event type
124+
For example, the following request specifies `file.type` as the event category
97125
field.
98126

99127
[source,console]
100128
----
101129
GET sec_logs/_eql/search
102130
{
103-
"event_category_field": "file.type",
104-
"timestamp_field": "@timestamp",
131+
"event_category_field": "file.type",
105132
"query": """
106133
file where agent.id == "8a4f500d"
107134
"""
@@ -124,7 +151,6 @@ timestamp field.
124151
GET sec_logs/_eql/search
125152
{
126153
"timestamp_field": "file.accessed",
127-
"event_category_field": "event.category",
128154
"query": """
129155
file where (file.size > 1 and file.type == "file")
130156
"""
@@ -148,8 +174,6 @@ filtered documents.
148174
----
149175
GET sec_logs/_eql/search
150176
{
151-
"event_category_field": "event.category",
152-
"timestamp_field": "@timestamp",
153177
"filter": {
154178
"range" : {
155179
"file.size" : {

0 commit comments

Comments
 (0)