Spaces method and path for this operation:
put /s/{space_id}/api/osquery/saved_queries/{id}
Refer to Spaces for more information.
Update a saved query using the query ID.
You cannot update a prebuilt saved query.
Body
Required
-
The saved query description.
-
Map osquery results columns or static values to Elastic Common Schema (ECS) fields
-
The ID of a saved query.
-
An interval, in seconds, on which to run the query.
-
Restricts the query to a specified platform. The default is all platforms. To specify multiple platforms, use commas. For example,
linux,darwin. -
The SQL query you want to run.
-
Indicates whether the query is removed.
-
Indicates whether the query is a snapshot.
-
Uses the Osquery versions greater than or equal to the specified version string.
PUT
/api/osquery/saved_queries/{id}
curl \
--request PUT 'https://<KIBANA_URL>/api/osquery/saved_queries/3c42c847-eb30-4452-80e0-728584042334' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"description":"Updated saved query description","id":"my_saved_query","interval":"120","platform":"linux,darwin","query":"select * from osquery_info;","timeout":60}'
Request example
{
"description": "Updated saved query description",
"id": "my_saved_query",
"interval": "120",
"platform": "linux,darwin",
"query": "select * from osquery_info;",
"timeout": 60
}
Response examples (200)
{
"data": {
"description": "Updated saved query description",
"id": "my_saved_query",
"interval": "120",
"platform": "linux,darwin",
"query": "select * from osquery_info;",
"saved_object_id": "42ba1280-2172-11ee-8523-5765fca79a3c",
"timeout": 60,
"updated_at": "2025-02-27T10:00:00.000Z",
"updated_by": "elastic"
}
}