-
Notifications
You must be signed in to change notification settings - Fork 191
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
Interactive investigation guides #2821
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
25baee3
Incomplete first draft
joepeeples 5e18a8b
Merge branch 'main' into 2696-investigation-guide-actions
joepeeples cafff58
Expands first draft, still in progress
joepeeples 947d6c7
Merge branch 'main' into 2696-investigation-guide-actions
joepeeples 24d9dd7
Complete first draft
joepeeples 2606f0f
Correct screenshot, some edits
joepeeples 35917bf
Merge branch 'main' into 2696-investigation-guide-actions
joepeeples 562a99f
Apply line edits
joepeeples 7b31b89
Revision based on Janeen's comments
joepeeples 12e0f21
Merge branch 'main' into 2696-investigation-guide-actions
joepeeples 3587cc7
Merge branch 'main' into 2696-investigation-guide-actions
joepeeples 34565cd
Apply suggestions from review
joepeeples a95f1fd
Add draft statement about escape characters
joepeeples f7eda88
Merge branch 'main' into 2696-investigation-guide-actions
joepeeples d407cd6
Edits from Paul, et al
joepeeples 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions
82
docs/experimental-features/investigation-guide-actions.asciidoc
This file contains 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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
[[interactive-investigation-guides]] | ||
== Interactive investigation guides | ||
|
||
NOTE: This feature is available for {stack} versions 8.6.0 and newer. | ||
|
||
Detection rule investigation guides suggest steps for triaging, analyzing, and responding to potential security issues. For custom rules, you can create an interactive investigation guide that includes buttons for launching runtime queries in <<timelines-ui,Timeline>>, using alert data and hard-coded literal values. This allows you to start detailed Timeline investigations directly from an alert using relevant data. | ||
|
||
[role="screenshot"] | ||
image::images/ig-alert-flyout.png[Alert details flyout with interactive investigation guide,550] | ||
|
||
Each query button displays in parentheses the number of documents found. Click the button to automatically create the query in Timeline based on settings specified in the investigation guide. | ||
|
||
[role="screenshot"] | ||
image::images/ig-timeline.png[Timeline with query pre-loaded from investigation guide action] | ||
|
||
[discrete] | ||
[[add-ig-actions-rule]] | ||
=== Add investigation guide actions to a rule | ||
|
||
NOTE: You can only create interactive investigation guides with custom rules because Elastic prebuilt rules can't be edited. However, you can duplicate a prebuilt rule, then configure the investigation guide for the duplicated rule. | ||
|
||
You can configure an interactive investigation guide when you <<rules-ui-create,create a new rule>> or <<edit-rules-settings,edit an existing rule>>. When configuring the rule's settings (the *About rule* step for a new rule, or the *About* tab for an existing rule), expand the *Advanced settings*, then scroll down to the *Investigation guide* field. | ||
|
||
[role="screenshot"] | ||
image::images/ig-investigation-guide-editor.png[Investigation guide editor field] | ||
|
||
Add the following syntax to the *Investigation guide* Markdown editor to configure a query. The syntax will appear as a clickable button in the investigation guide. | ||
|
||
[width="100%",options="header"] | ||
|=== | ||
|Field |Description | ||
|
||
|`!{insight{ }}` |The container object holding all the configuration attributes for the button and the query. | ||
|`label` |Text to identify the button. | ||
|`description` |Additional text to include on the button. | ||
|`providers` a|A two-level nested array that defines the query you want to run in Timeline. Similar to the structure of queries in Timeline, items in the outer level are joined by an `OR` relationship, and items in the inner level are joined by an `AND` relationship. | ||
|
||
Each item in `providers` is defined by these attributes: | ||
|
||
* `field`: The name of a field to query. | ||
* `value`: The value to search for. Either a hard-coded literal value, or the name of the field on the alert whose value you want to use as a query parameter. | ||
* `type`: Either `literal` or `parameter`. | ||
|=== | ||
|
||
NOTE: Some characters must be escaped with a backslash, such as `\"` for a quotation mark and `\\` for a literal backslash. Windows paths must be divided with double backslashes (for example, `C:\\Windows\\explorer.exe`), and paths that already include double backslashes might require four backslashes for each divider. A clickable error icon (image:images/ig-error-icon.png[Error icon,19,18]) displays below the Markdown editor if there are any syntax errors. | ||
|
||
[discrete] | ||
==== Example syntax | ||
|
||
[source,json] | ||
---- | ||
!{insight{ | ||
"label": "Test action", | ||
"description": "Click to investigate", | ||
"providers": [ | ||
[ | ||
{"field": "event.id", "value": "kibana.alert.original_event.id", "type": "parameter"} | ||
], | ||
[ | ||
{"field": "event.action", "value": "rename", "type": "literal"}, | ||
{"field": "process.pid", "value": "process.pid", "type": "parameter"} | ||
] | ||
] | ||
}} | ||
---- | ||
|
||
This example creates the following Timeline query, as illustrated below: | ||
|
||
`(event.id : <alert value>)` + | ||
`OR (event.action : "rename" AND process.pid : <alert value>)` | ||
|
||
[role="screenshot"] | ||
image::images/ig-timeline-query.png[Timeline query,500] | ||
|
||
[discrete] | ||
==== Timeline template fields | ||
|
||
When viewing an interactive investigation guide in contexts unconnected to a specific alert (such a rule's details page), queries open as <<timeline-templates-ui,Timeline templates>>, and `parameter` fields are treated as Timeline template fields. | ||
|
||
[role="screenshot"] | ||
image::images/ig-timeline-template-fields.png[Timeline template,500] | ||
|
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.
We should mention here that any value that contains a \ character need to be double escaped, i.e. a windows file path would be "C:\\Windows\\System32". This is a bit gross without the form builder doing this for them, but won't be an issue next release. The reason for this is that JSON.stringify/JSON.parse is ultimately used twice, once on the entire markdown snippet, and once on the provider part of the snippet.
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.
ha the github markdown behaves similarly, that was supposed to be 4 slashes delineating each part of the path, so I think it ends up being 8. "C:\\\\Windows\\\\System32"
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.
Thanks @kqualters-elastic! Are there any other special characters that need to be escaped, either double
\\
or single\
?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.
Ya I believe all the other JSON special characters as well:
\b Backspace (ascii code 08)
\f Form feed (ascii code 0C)
\n New line
\r Carriage return
\t Tab
" Double quote
\ Backslash character
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.
@kqualters-elastic I added a note to explain escape characters, based on our Slack discussion. It's intentionally a little more general, pointing to the error icon to help users troubleshoot syntax errors. Feel free to edit as needed, once you've confirmed how exactly the characters work.