6
6
<titleabbrev>Function reference</titleabbrev>
7
7
++++
8
8
9
- {es} supports the following <<eql-functions,EQL functions>>. Most EQL functions
10
- are case-sensitive by default.
9
+ {es} supports the following <<eql-functions,EQL functions>>.
11
10
12
11
[discrete]
13
12
[[eql-fn-add]]
@@ -61,27 +60,31 @@ If using a field as the argument, this parameter supports only
61
60
=== `between`
62
61
63
62
Extracts a substring that's between a provided `left` and `right` text in a
64
- source string. Matching is case-sensitive.
63
+ source string. Matching is case-sensitive by default .
65
64
66
65
*Example*
67
66
[source,eql]
68
67
----
69
68
// file.path = "C:\\Windows\\System32\\cmd.exe"
70
- between(file.path, "system32\\\\", ".exe") // returns "cmd"
69
+ between(file.path, "System32\\\\", ".exe") // returns "cmd"
70
+ between(file.path, "system32\\\\", ".exe") // returns ""
71
71
between(file.path, "workspace\\\\", ".exe") // returns ""
72
72
73
+ // Make matching case-insensitive
74
+ between~(file.path, "system32\\\\", ".exe") // returns "cmd"
75
+
73
76
// Greedy matching defaults to false.
74
77
between(file.path, "\\\\", "\\\\", false) // returns "Windows"
75
78
76
79
// Sets greedy matching to true
77
80
between(file.path, "\\\\", "\\\\", true) // returns "Windows\\System32"
78
81
79
82
// empty source string
80
- between("", "system32 \\\\", ".exe") // returns ""
83
+ between("", "System32 \\\\", ".exe") // returns ""
81
84
between("", "", "") // returns ""
82
85
83
86
// null handling
84
- between(null, "system32 \\\\", ".exe") // returns null
87
+ between(null, "System32 \\\\", ".exe") // returns null
85
88
----
86
89
87
90
*Syntax*
@@ -340,15 +343,19 @@ If using a field as the argument, this parameter supports only
340
343
=== `endsWith`
341
344
342
345
Returns `true` if a source string ends with a provided substring. Matching is
343
- case-sensitive.
346
+ case-sensitive by default .
344
347
345
348
*Example*
346
349
[source,eql]
347
350
----
348
351
endsWith("regsvr32.exe", ".exe") // returns true
352
+ endsWith("regsvr32.exe", ".EXE") // returns false
349
353
endsWith("regsvr32.exe", ".dll") // returns false
350
354
endsWith("", "") // returns true
351
355
356
+ // Make matching case-insensitive
357
+ endsWith~("regsvr32.exe", ".EXE") // returns true
358
+
352
359
// file.name = "regsvr32.exe"
353
360
endsWith(file.name, ".exe") // returns true
354
361
endsWith(file.name, ".dll") // returns false
@@ -405,7 +412,7 @@ field data types:
405
412
=== `indexOf`
406
413
407
414
Returns the first position of a provided substring in a source string. Matching
408
- is case-sensitive.
415
+ is case-sensitive by default .
409
416
410
417
If an optional start position is provided, this function returns the first
411
418
occurrence of the substring at or after the start position.
@@ -414,11 +421,16 @@ occurrence of the substring at or after the start position.
414
421
[source,eql]
415
422
----
416
423
// url.domain = "subdomain.example.com"
424
+ indexOf(url.domain, "d") // returns 3
425
+ indexOf(url.domain, "D") // returns null
417
426
indexOf(url.domain, ".") // returns 9
418
427
indexOf(url.domain, ".", 9) // returns 9
419
428
indexOf(url.domain, ".", 10) // returns 17
420
429
indexOf(url.domain, ".", -6) // returns 9
421
430
431
+ // Make matching case-insensitive
432
+ indexOf~(url.domain, "D") // returns 4
433
+
422
434
// empty strings
423
435
indexOf("", "") // returns 0
424
436
indexOf(url.domain, "") // returns 0
@@ -748,15 +760,19 @@ Fields are not supported as arguments.
748
760
=== `startsWith`
749
761
750
762
Returns `true` if a source string begins with a provided substring. Matching is
751
- case-sensitive.
763
+ case-sensitive by default .
752
764
753
765
*Example*
754
766
[source,eql]
755
767
----
756
768
startsWith("regsvr32.exe", "regsvr32") // returns true
769
+ startsWith("regsvr32.exe", "Regsvr32") // returns false
757
770
startsWith("regsvr32.exe", "explorer") // returns false
758
771
startsWith("", "") // returns true
759
772
773
+ // Make matching case-insensitive
774
+ startsWith~("regsvr32.exe", "Regsvr32") // returns true
775
+
760
776
// process.name = "regsvr32.exe"
761
777
startsWith(process.name, "regsvr32") // returns true
762
778
startsWith(process.name, "explorer") // returns false
@@ -848,16 +864,20 @@ If using a field as the argument, this parameter does not support the
848
864
=== `stringContains`
849
865
850
866
Returns `true` if a source string contains a provided substring. Matching is
851
- case-sensitive.
867
+ case-sensitive by default .
852
868
853
869
*Example*
854
870
[source,eql]
855
871
----
856
872
// process.command_line = "start regsvr32.exe"
857
873
stringContains(process.command_line, "regsvr32") // returns true
874
+ stringContains(process.command_line, "Regsvr32") // returns false
858
875
stringContains(process.command_line, "start ") // returns true
859
876
stringContains(process.command_line, "explorer") // returns false
860
877
878
+ // Make matching case-insensitive
879
+ stringContains~(process.command_line, "Regsvr32") // returns false
880
+
861
881
// process.name = "regsvr32.exe"
862
882
stringContains(command_line, process.name) // returns true
863
883
@@ -1008,18 +1028,22 @@ If using a field as the argument, this parameter supports only
1008
1028
=== `wildcard`
1009
1029
1010
1030
Returns `true` if a source string matches one or more provided wildcard
1011
- expressions. Matching is case-sensitive.
1031
+ expressions. Matching is case-sensitive by default .
1012
1032
1013
1033
*Example*
1014
1034
[source,eql]
1015
1035
----
1016
1036
// The * wildcard matches zero or more characters.
1017
1037
// process.name = "regsvr32.exe"
1018
1038
wildcard(process.name, "*regsvr32*") // returns true
1039
+ wildcard(process.name, "*Regsvr32*") // returns false
1019
1040
wildcard(process.name, "*regsvr32*", "*explorer*") // returns true
1020
1041
wildcard(process.name, "*explorer*") // returns false
1021
1042
wildcard(process.name, "*explorer*", "*scrobj*") // returns false
1022
1043
1044
+ // Make matching case-insensitive
1045
+ wildcard~(process.name, "*Regsvr32*") // returns true
1046
+
1023
1047
// The ? wildcard matches exactly one character.
1024
1048
// process.name = "regsvr32.exe"
1025
1049
wildcard(process.name, "regsvr32.e?e") // returns true
0 commit comments