Skip to content

Commit

Permalink
[DOCS] EQL: Document cidrMatch function (#54216) (#55739)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig authored Apr 24, 2020
1 parent 87b4979 commit e4ebe55
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions docs/reference/eql/functions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ experimental::[]
{es} supports the following EQL functions:

* <<eql-fn-between>>
* <<eql-fn-cidrmatch>>
* <<eql-fn-endswith>>
* <<eql-fn-indexof>>
* <<eql-fn-length>>
Expand Down Expand Up @@ -128,6 +129,55 @@ If `true`, matching is case-sensitive. Defaults to `false`.
*Returns:* string or `null`
====

[discrete]
[[eql-fn-cidrmatch]]
==== `cidrMatch`

Returns `true` if an IP address is contained in one or more provided
https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing[CIDR] blocks.

[%collapsible]
====
*Example*
[source,eql]
----
// source.address = "192.168.152.12"
cidrMatch(source.address, "192.168.0.0/16") // returns true
cidrMatch(source.address, "192.168.0.0/16", "10.0.0.0/8") // returns true
cidrMatch(source.address, "10.0.0.0/8") // returns false
cidrMatch(source.address, "10.0.0.0/8", "10.128.0.0/9") // returns false
// null handling
cidrMatch(null, "10.0.0.0/8") // returns null
cidrMatch(source.address, null) // returns null
----
*Syntax*
[source,txt]
----
`cidrMatch(<ip_address>, <cidr_block>[, ...])`
----
*Parameters*
`<ip_address>`::
(Required, string or `null`)
IP address. Supports
https://en.wikipedia.org/wiki/IPv4[IPv4] and
https://en.wikipedia.org/wiki/IPv6[IPv6] addresses. If `null`, the function
returns `null`.
+
If using a field as the argument, this parameter supports only the <<ip,`ip`>>
field datatype.
`<cidr_block>`::
(Required{multi-arg}, string or `null`)
CIDR block you wish to search. If `null`, the function returns `null`.
*Returns:* boolean or `null`
====

[discrete]
[[eql-fn-endswith]]
=== `endsWith`
Expand Down

0 comments on commit e4ebe55

Please sign in to comment.