Skip to content

Commit cc3bd39

Browse files
authored
[DOCS] EQL: Document head and tail pipes (#58673)
1 parent 914e84d commit cc3bd39

File tree

5 files changed

+125
-1
lines changed

5 files changed

+125
-1
lines changed

docs/reference/eql/functions.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[eql-function-ref]]
24
== EQL function reference
35
++++

docs/reference/eql/index.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ Consider using EQL if you:
5050
* <<eql-search>>
5151
* <<eql-syntax>>
5252
* <<eql-function-ref>>
53+
* <<eql-pipe-ref>>
5354
* <<eql-limitations>>
5455

5556
include::requirements.asciidoc[]
5657
include::search.asciidoc[]
5758
include::syntax.asciidoc[]
5859
include::functions.asciidoc[]
60+
include::pipes.asciidoc[]
5961
include::limitations.asciidoc[]

docs/reference/eql/limitations.asciidoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ queries that contain:
3535
** `descendant of`
3636
** `event of`
3737

38-
* {eql-ref}/pipes.html[Pipes]
38+
* The following {eql-ref}/pipes.html[pipes]:
39+
** {eql-ref}/pipes.html#count[`count`]
40+
** {eql-ref}/pipes.html#filter[`filter`]
41+
** {eql-ref}/pipes.html#sort[`sort`]
42+
** {eql-ref}/pipes.html#unique[`unique`]
43+
** {eql-ref}/pipes.html#unique-count[`unique_count`]
3944

4045
* {eql-ref}/sequences.html[State and timespan-related sequence keywords]:
4146
** `with maxspan`

docs/reference/eql/pipes.asciidoc

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
[role="xpack"]
2+
[testenv="basic"]
3+
[[eql-pipe-ref]]
4+
== EQL pipe reference
5+
++++
6+
<titleabbrev>Pipe reference</titleabbrev>
7+
++++
8+
9+
dev::[]
10+
11+
{es} supports the following EQL pipes:
12+
13+
* <<eql-pipe-head>>
14+
* <<eql-pipe-tail>>
15+
16+
[discrete]
17+
[[eql-pipe-head]]
18+
=== `head`
19+
20+
Returns up to a specified number of events, starting with the earliest matching
21+
events. Works similarly to the
22+
https://en.wikipedia.org/wiki/Head_(Unix)[Unix head command].
23+
24+
[%collapsible]
25+
====
26+
*Example*
27+
28+
The following EQL query returns up to fifty of the earliest powershell
29+
commands.
30+
31+
[source,eql]
32+
----
33+
process where process.name == "powershell.exe"
34+
| head 50
35+
----
36+
37+
*Syntax*
38+
[source,txt]
39+
----
40+
head <max>
41+
----
42+
43+
*Parameters*
44+
45+
`<max>`::
46+
(Required, integer)
47+
Maximum number of matching events to return.
48+
====
49+
50+
[discrete]
51+
[[eql-pipe-tail]]
52+
=== `tail`
53+
54+
Returns up to a specified number of events, starting with the most recent
55+
matching events. Works similarly to the
56+
https://en.wikipedia.org/wiki/Tail_(Unix)[Unix tail command].
57+
58+
[%collapsible]
59+
====
60+
*Example*
61+
62+
The following EQL query returns up to thirty of the most recent `svchost.exe`
63+
processes.
64+
65+
[source,eql]
66+
----
67+
process where process.name == "svchost.exe"
68+
| tail 30
69+
----
70+
71+
*Syntax*
72+
[source,txt]
73+
----
74+
tail <max>
75+
----
76+
77+
*Parameters*
78+
79+
`<max>`::
80+
(Required, integer)
81+
Maximum number of matching events to return.
82+
====

docs/reference/eql/syntax.asciidoc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,3 +473,36 @@ file where file.extension in ("exe", "dll")
473473
We recommend testing and benchmarking any indexing changes before deploying them
474474
in production. See <<tune-for-indexing-speed>> and <<tune-for-search-speed>>.
475475
====
476+
477+
[discrete]
478+
[[eql-pipes]]
479+
=== Pipes
480+
481+
EQL pipes filter, aggregate, and post-process events returned by
482+
an EQL query. You can use pipes to narrow down EQL query results or make them
483+
more specific.
484+
485+
Pipes are delimited using the pipe (`|`) character.
486+
487+
[source,eql]
488+
----
489+
event_category where condition | pipe
490+
----
491+
492+
.*Example*
493+
[%collapsible]
494+
====
495+
The following EQL query uses the `tail` pipe to return only the 10 most recent
496+
events matching the query.
497+
498+
[source,eql]
499+
----
500+
authentication where agent.id == 4624
501+
| tail 10
502+
----
503+
====
504+
505+
You can pass the output of a pipe to another pipe. This lets you use multiple
506+
pipes with a single query.
507+
508+
For a list of supported pipes, see <<eql-pipe-ref>>.

0 commit comments

Comments
 (0)