@@ -9,6 +9,7 @@ experimental::[]
9
9
{es} supports the following EQL functions:
10
10
11
11
* <<eql-fn-between>>
12
+ * <<eql-fn-cidrmatch>>
12
13
* <<eql-fn-endswith>>
13
14
* <<eql-fn-indexof>>
14
15
* <<eql-fn-length>>
@@ -128,6 +129,55 @@ If `true`, matching is case-sensitive. Defaults to `false`.
128
129
*Returns:* string or `null`
129
130
====
130
131
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
+
131
181
[discrete]
132
182
[[eql-fn-endswith]]
133
183
=== `endsWith`
0 commit comments