Skip to content

Commit d222404

Browse files
authored
[DOCS] EQL: Document cidrMatch function (#54216)
1 parent ddb1699 commit d222404

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

docs/reference/eql/functions.asciidoc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ experimental::[]
99
{es} supports the following EQL functions:
1010

1111
* <<eql-fn-between>>
12+
* <<eql-fn-cidrmatch>>
1213
* <<eql-fn-endswith>>
1314
* <<eql-fn-indexof>>
1415
* <<eql-fn-length>>
@@ -128,6 +129,55 @@ If `true`, matching is case-sensitive. Defaults to `false`.
128129
*Returns:* string or `null`
129130
====
130131

132+
[discrete]
133+
[[eql-fn-cidrmatch]]
134+
==== `cidrMatch`
135+
136+
Returns `true` if an IP address is contained in one or more provided
137+
https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing[CIDR] blocks.
138+
139+
[%collapsible]
140+
====
141+
*Example*
142+
143+
[source,eql]
144+
----
145+
// source.address = "192.168.152.12"
146+
cidrMatch(source.address, "192.168.0.0/16") // returns true
147+
cidrMatch(source.address, "192.168.0.0/16", "10.0.0.0/8") // returns true
148+
cidrMatch(source.address, "10.0.0.0/8") // returns false
149+
cidrMatch(source.address, "10.0.0.0/8", "10.128.0.0/9") // returns false
150+
151+
// null handling
152+
cidrMatch(null, "10.0.0.0/8") // returns null
153+
cidrMatch(source.address, null) // returns null
154+
----
155+
156+
*Syntax*
157+
[source,txt]
158+
----
159+
`cidrMatch(<ip_address>, <cidr_block>[, ...])`
160+
----
161+
162+
*Parameters*
163+
164+
`<ip_address>`::
165+
(Required, string or `null`)
166+
IP address. Supports
167+
https://en.wikipedia.org/wiki/IPv4[IPv4] and
168+
https://en.wikipedia.org/wiki/IPv6[IPv6] addresses. If `null`, the function
169+
returns `null`.
170+
+
171+
If using a field as the argument, this parameter supports only the <<ip,`ip`>>
172+
field datatype.
173+
174+
`<cidr_block>`::
175+
(Required{multi-arg}, string or `null`)
176+
CIDR block you wish to search. If `null`, the function returns `null`.
177+
178+
*Returns:* boolean or `null`
179+
====
180+
131181
[discrete]
132182
[[eql-fn-endswith]]
133183
=== `endsWith`

0 commit comments

Comments
 (0)