Skip to content

[DOCS] Add basic EQL search tutorial docs #51574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/reference/eql/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ Consider using EQL if you:
=== In this section

* <<eql-requirements>>
* <<eql-search>>
* <<eql-syntax>>

include::requirements.asciidoc[]
include::search.asciidoc[]
include::syntax.asciidoc[]
2 changes: 2 additions & 0 deletions docs/reference/eql/requirements.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<titleabbrev>Requirements</titleabbrev>
++++

experimental::[]

EQL is schemaless and works out-of-the-box with most common log formats. If you
use a standard log format and already know what fields in your index contain
event type and timestamp information, you can skip this page.
Expand Down
46 changes: 46 additions & 0 deletions docs/reference/eql/search.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[role="xpack"]
[testenv="basic"]
[[eql-search]]
== Run an EQL search

experimental::[]

To start using EQL in {es}, first ensure your event data meets
<<eql-requirements,EQL requirements>>. Then ingest or add the data to an {es}
index.

The following <<docs-bulk,bulk API>> request adds some example log data to the
`sec_logs` index. This log data follows the {ecs-ref}[Elastic Common Schema
(ECS)].

[source,console]
----
PUT sec_logs/_bulk?refresh
{"index":{"_index" : "sec_logs"}}
{ "@timestamp": "2020-12-07T11:06:07.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process" }, "process": { "name": "cmd.exe", "path": "C:\\Windows\\System32\\cmd.exe" } }
{"index":{"_index" : "sec_logs"}}
{ "@timestamp": "2020-12-07T11:07:08.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "image_load" }, "file": { "name": "cmd.exe", "path": "C:\\Windows\\System32\\cmd.exe" }, "process": { "name": "cmd.exe", "path": "C:\\Windows\\System32\\cmd.exe" } }
{"index":{"_index" : "sec_logs"}}
{ "@timestamp": "2020-12-07T11:07:09.000Z", "agent": { "id": "8a4f500d" }, "event": { "category": "process" }, "process": { "name": "regsvr32.exe", "path": "C:\\Windows\\System32\\regsvr32.exe" } }
----

You can now use the EQL search API to search this index using an EQL query.

The following request searches the `sec_logs` index using the EQL query
specified in the `rule` parameter. The EQL query matches events with an
`event.category` of `process` that have a `process.name` of `cmd.exe`.

[source,console]
----
GET sec_logs/_eql/search
{
"rule": """
process where process.name == "cmd.exe"
"""
}
----
// TEST[continued]

Because the `sec_log` index follows the ECS, you don't need to specify the
event type or timestamp fields. The request uses the `event.category` and
`@timestamp` fields by default.
5 changes: 0 additions & 5 deletions docs/reference/redirects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,3 @@ See <<slm-api-start>>.
=== Stop {slm} API

See <<slm-api-stop>>.

[role="exclude",id="eql-search"]
=== EQL search API

See <<eql>>.