Skip to content
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

Placeholder fields and Osquery UI updates #3045

Merged
merged 27 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
92ed3b8
First draft
nastasha-solomon Mar 8, 2023
ae30c94
Fix ref
nastasha-solomon Mar 9, 2023
a8aff2c
Adding to index file
nastasha-solomon Mar 9, 2023
0ebd027
Moar stuff
nastasha-solomon Mar 9, 2023
4291351
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 9, 2023
84f7e2d
Revisions and revisions
nastasha-solomon Mar 13, 2023
20d3d0c
Clean up
nastasha-solomon Mar 13, 2023
d91a00b
Merge branch 'main' into issue-2981-2872-osquery-replace-params
nastasha-solomon Mar 13, 2023
adb1fa9
Re-org
nastasha-solomon Mar 19, 2023
c566db6
Merge branch 'issue-2981-2872-osquery-replace-params' of github.com:e…
nastasha-solomon Mar 19, 2023
1346444
Style fix
nastasha-solomon Mar 19, 2023
5cc3ce7
Add missing single qoute
nastasha-solomon Mar 19, 2023
5536eb3
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 21, 2023
af725b5
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 21, 2023
99353d3
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 21, 2023
f6b2c0b
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 21, 2023
77f133e
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 21, 2023
cb52ba4
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 21, 2023
0479221
Update docs/osquery/osquery-response-action.asciidoc
nastasha-solomon Mar 21, 2023
5f4d3da
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 27, 2023
2642da8
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 27, 2023
e55f9ff
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 27, 2023
bc3115d
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 27, 2023
26f9711
Merge branch 'main' into issue-2981-2872-osquery-replace-params
nastasha-solomon Mar 28, 2023
3ca7b16
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 28, 2023
2d8d1be
Update docs/osquery/osquery-placeholder-fields.asciidoc
nastasha-solomon Mar 28, 2023
4b09538
Merge branch 'main' into issue-2981-2872-osquery-replace-params
nastasha-solomon Mar 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/osquery/alerts-run-osquery.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ NOTE: The host associated with the alert is automatically selected. You can spec

. Specify the query or pack to run:
** *Query*: Select a saved query or enter a new one in the text box. After you enter the query, you can expand the **Advanced** section to view or set {kibana-ref}/osquery.html#osquery-map-fields[mapped ECS fields] included in the results from the live query. Mapping ECS fields is optional.
+
TIP: Use <<osquery-placeholder-fields,placeholder fields>> to dynamically add existing alert data to your query.

** *Pack*: Select from available query packs. After you select a pack, all of the queries in the pack are displayed.
+
TIP: Refer to {kibana-ref}/osquery.html#osquery-prebuilt-packs-queries[prebuilt packs] to learn about using and managing Elastic prebuilt packs.
Expand Down
3 changes: 3 additions & 0 deletions docs/osquery/invest-guide-run-osquery.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ NOTE: You can only add Osquery to investigation guides for custom rules because
. Scroll down to the Investigation guide section. In the toolbar, click the *Osquery* button (image:images/osquery-button.png[Click the Osquery button,20,20]).
.. Add a descriptive label for the query; for example, `Search for executables`.
.. Select a saved query or enter a new one.
+
TIP: Use <<osquery-placeholder-fields,placeholder fields>> to dynamically add existing alert data to your query.

.. Expand the **Advanced** section to view or set {kibana-ref}/osquery.html#osquery-map-fields[mapped ECS fields] included in the results from the live query (optional).
+
[role="screenshot"]
Expand Down
4 changes: 3 additions & 1 deletion docs/osquery/osquery-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ include::invest-guide-run-osquery.asciidoc[][leveloffset=+1]

include::alerts-run-osquery.asciidoc[][leveloffset=+1]

include::view-osquery-results.asciidoc[][leveloffset=+1]
include::view-osquery-results.asciidoc[][leveloffset=+1]

include::osquery-placeholder-fields.asciidoc[][leveloffset=+1]
29 changes: 29 additions & 0 deletions docs/osquery/osquery-placeholder-fields.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[[osquery-placeholder-fields]]
== Use placeholder fields in Osquery queries

Instead of hard-coding alert and event values into Osquery queries, you can use placeholder fields to dynamically pass this data into queries. Placeholder fields function like parameters. You can use placeholder fields to build flexible and reusable queries.

Placeholder fields work in single queries or query packs. They're also supported in the following features:

* <<alerts-run-osquery,Live queries>>
* <<osquery-response-action,Osquery Response Actions>>
+
* <<invest-guide-run-osquery,Investigation guides using Osquery queries>>

[float]
[[placeholder-field-syntax]]
=== Placeholder field syntax and requirements

Placeholder fields use http://mustache.github.io/[mustache syntax] and must be wrapped in double curly brackets (`{{example.field}}`). You can use any field within an event or alert document as a placeholder field.

Queries with placeholder fields can only run against alerts or events. Otherwise, they will lack the necessary values and be `Skipped`.
nastasha-solomon marked this conversation as resolved.
Show resolved Hide resolved

[float]
[[placeholder-field-example]]
==== Example query with a placeholder field

The following query uses the `{{host.name}}` placeholder field:

`SELECT * FROM os_version WHERE name = `{{host.os.name}}``

When you run the query, the value that's stored in the alert or event's `host.name` field will be transferred to the `{{host.os.name}}` placeholder field.
3 changes: 3 additions & 0 deletions docs/osquery/osquery-response-action.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ You can add Osquery Response Actions to new or existing custom query rules. Quer
** *Existing rule*: Edit the rule's settings, then go to the *Actions* tab. In the tab, click the *osquery* icon under the Response Actions section.
. Specify whether you want to set up a single live query or a pack:
** *Query*: Select a saved query or enter a new one. After you enter the query, you can expand the **Advanced** section to view or set {kibana-ref}/osquery.html#osquery-map-fields[mapped ECS fields] included in the results from the live query. Mapping ECS fields is optional.
+
TIP: You can use <<osquery-placeholder-fields,placeholder fields>> to dynamically add alert data to your query.

** *Pack*: Select from available query packs. After you select a pack, all of the queries in the pack are displayed.
+
TIP: Refer to {kibana-ref}/osquery.html#osquery-prebuilt-packs-queries[prebuilt packs] to learn about using and managing Elastic prebuilt packs.
Expand Down