-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[DOCS] EQL: Document stringContains function
#54968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jrodewig
merged 7 commits into
elastic:master
from
jrodewig:docs__eql-fn-stringcontains
Apr 24, 2020
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9171207
[DOCS] EQL: Document `stringContains` function
jrodewig e85fe36
correction
jrodewig 8bcb8f8
update examples
jrodewig 9d8e96c
remove array refs
jrodewig b06cfdd
reword
jrodewig 8b9e260
Merge remote-tracking branch 'upstream/master' into docs__eql-fn-stri…
jrodewig 5ccc198
Add another example
jrodewig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,7 @@ experimental::[] | |||||||
| * <<eql-fn-endswith>> | ||||||||
| * <<eql-fn-length>> | ||||||||
| * <<eql-fn-startswith>> | ||||||||
| * <<eql-fn-stringcontains>> | ||||||||
| * <<eql-fn-substring>> | ||||||||
|
|
||||||||
| [discrete] | ||||||||
|
|
@@ -223,6 +224,72 @@ field datatypes: | |||||||
| *Returns:* boolean or `null` | ||||||||
| ==== | ||||||||
|
|
||||||||
| [discrete] | ||||||||
| [[eql-fn-stringcontains]] | ||||||||
| === `stringContains` | ||||||||
|
|
||||||||
| Returns `true` if a source string contains a provided substring. | ||||||||
|
|
||||||||
| [%collapsible] | ||||||||
| ==== | ||||||||
| *Example* | ||||||||
| [source,eql] | ||||||||
| ---- | ||||||||
| // process.command_line = "start regsvr32.exe" | ||||||||
| stringContains(process.command_line, "regsvr32") // returns true | ||||||||
| stringContains(process.command_line, "start ") // returns true | ||||||||
| stringContains(process.command_line, "explorer") // returns false | ||||||||
|
|
||||||||
| // process.command_line = [ "start regsvr32.exe", "start explorer.exe" ] | ||||||||
| stringContains(process.command_line, "regsvr32") // returns false | ||||||||
| stringContains(process.command_line, "explorer") // returns true | ||||||||
|
|
||||||||
| // empty strings | ||||||||
| stringContains("", "") // returns false | ||||||||
| stringContains("start regsvr32.exe", "") // returns false | ||||||||
|
|
||||||||
| // null handling | ||||||||
| stringContains(null, "regsvr32") // returns null | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based off the conversation today,
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Updated with 8bcb8f8. |
||||||||
| ---- | ||||||||
|
|
||||||||
| *Syntax* | ||||||||
| [source,txt] | ||||||||
| ---- | ||||||||
| stringContains(<source>, <substring>) | ||||||||
| ---- | ||||||||
|
|
||||||||
| *Parameters* | ||||||||
| `<source>`:: | ||||||||
| (Required, string or `null`) | ||||||||
| Source string to search. If `null`, the function returns `null`. | ||||||||
|
|
||||||||
| If using a field as the argument, this parameter only supports the following | ||||||||
| field datatypes: | ||||||||
|
|
||||||||
| * <<keyword,`keyword`>> | ||||||||
| * <<constant-keyword,`constant_keyword`>> | ||||||||
| * <<text,`text`>> field with a <<keyword,`keyword`>> or | ||||||||
| <<constant-keyword,`constant_keyword`>> sub-field | ||||||||
|
|
||||||||
| Fields containing <<array,array values>> use the first array item only. | ||||||||
|
|
||||||||
| `<substring>`:: | ||||||||
| (Required, string or `null`) | ||||||||
| Substring to search for. If `null`, the function returns `null`. | ||||||||
|
|
||||||||
| If using a field as the argument, this parameter only supports the following | ||||||||
| field datatypes: | ||||||||
|
|
||||||||
| * <<keyword,`keyword`>> | ||||||||
| * <<constant-keyword,`constant_keyword`>> | ||||||||
| * <<text,`text`>> field with a <<keyword,`keyword`>> or | ||||||||
| <<constant-keyword,`constant_keyword`>> sub-field | ||||||||
|
|
||||||||
| <<array,Array values>> are not supported. | ||||||||
|
|
||||||||
| *Returns:* boolean or `null` | ||||||||
| ==== | ||||||||
|
|
||||||||
| [discrete] | ||||||||
| [[eql-fn-substring]] | ||||||||
| === `substring` | ||||||||
|
|
||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add one additional example, to show a less obvious usage:
stringContains(process.path, process.name).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added with 5ccc198. Thanks!