Skip to main content

saved_searches

Creates, updates, deletes, gets or lists a saved_searches resource.

Overview

Namesaved_searches
TypeResource
Idazure.log_analytics.saved_searches

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
categorystringThe category of the saved search. This helps the user to find a saved search faster. Required.
displayNamestringSaved search display name. Required.
etagstringThe ETag of the saved search. To override an existing saved search, use "*" or specify the current Etag.
functionAliasstringThe function alias if query serves as a function.
functionParametersstringThe optional function parameters if query serves as a function. Value should be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. For more examples and proper syntax please refer to https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions _.
querystringThe query expression for the saved search. Required.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsarrayThe tags attached to the saved search.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
versionintegerThe version number of the query language. The current version is 2 and is the default.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, workspace_name, saved_search_id, subscription_idGets the specified saved search for a given workspace.
list_by_workspaceselectresource_group_name, workspace_name, subscription_idGets the saved searches for a given Log Analytics Workspace.
create_or_updateinsertresource_group_name, workspace_name, saved_search_id, subscription_id, propertiesCreates or updates a saved search for a given workspace.
create_or_updatereplaceresource_group_name, workspace_name, saved_search_id, subscription_id, propertiesCreates or updates a saved search for a given workspace.
deletedeleteresource_group_name, workspace_name, saved_search_id, subscription_idDeletes the specified saved search in a given workspace.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
saved_search_idstringThe id of the saved search. Required.
subscription_idstring
workspace_namestringThe name of the workspace. Required.

SELECT examples

Gets the specified saved search for a given workspace.

SELECT
id,
name,
category,
displayName,
etag,
functionAlias,
functionParameters,
query,
systemData,
tags,
type,
version
FROM azure.log_analytics.saved_searches
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND workspace_name = '{{ workspace_name }}' -- required
AND saved_search_id = '{{ saved_search_id }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Creates or updates a saved search for a given workspace.

INSERT INTO azure.log_analytics.saved_searches (
properties,
etag,
resource_group_name,
workspace_name,
saved_search_id,
subscription_id
)
SELECT
'{{ properties }}' /* required */,
'{{ etag }}',
'{{ resource_group_name }}',
'{{ workspace_name }}',
'{{ saved_search_id }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
properties,
systemData,
type
;

REPLACE examples

Creates or updates a saved search for a given workspace.

REPLACE azure.log_analytics.saved_searches
SET
properties = '{{ properties }}',
etag = '{{ etag }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND workspace_name = '{{ workspace_name }}' --required
AND saved_search_id = '{{ saved_search_id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND properties = '{{ properties }}' --required
RETURNING
id,
name,
etag,
properties,
systemData,
type;

DELETE examples

Deletes the specified saved search in a given workspace.

DELETE FROM azure.log_analytics.saved_searches
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND workspace_name = '{{ workspace_name }}' --required
AND saved_search_id = '{{ saved_search_id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;