saved_queries
Creates, updates, deletes, gets or lists a saved_queries
resource.
Overview
Name | saved_queries |
Type | Resource |
Id | google.logging.saved_queries |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Output only. Resource name of the saved query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support#bucket-regions)After the saved query is created, the location cannot be changed.If the user doesn't provide a QUERY_ID, the system will generate an alphanumeric ID. |
description | string | Optional. A human readable description of the saved query. |
createTime | string | Output only. The timestamp when the saved query was created. |
displayName | string | Required. The user specified title for the SavedQuery. |
loggingQuery | object | Describes a Cloud Logging query that can be run in Logs Explorer UI or via the logging API.In addition to the query itself, additional information may be stored to capture the display configuration and other UI state used in association with analysis of query results. |
opsAnalyticsQuery | object | Describes an analytics query that can be run in the Log Analytics page of Google Cloud console.Preview: This is a preview feature and may be subject to change before final release. |
updateTime | string | Output only. The timestamp when the saved query was last updated. |
visibility | string | Required. The visibility status of this query, which determines its ownership. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
billing_accounts_locations_saved_queries_get | SELECT | billingAccountsId, locationsId, savedQueriesId | Returns all data associated with the requested query. |
billing_accounts_locations_saved_queries_list | SELECT | billingAccountsId, locationsId | Lists the SavedQueries that were created by the user making the request. |
folders_locations_saved_queries_get | SELECT | foldersId, locationsId, savedQueriesId | Returns all data associated with the requested query. |
folders_locations_saved_queries_list | SELECT | foldersId, locationsId | Lists the SavedQueries that were created by the user making the request. |
organizations_locations_saved_queries_get | SELECT | locationsId, organizationsId, savedQueriesId | Returns all data associated with the requested query. |
organizations_locations_saved_queries_list | SELECT | locationsId, organizationsId | Lists the SavedQueries that were created by the user making the request. |
projects_locations_saved_queries_get | SELECT | locationsId, projectsId, savedQueriesId | Returns all data associated with the requested query. |
projects_locations_saved_queries_list | SELECT | locationsId, projectsId | Lists the SavedQueries that were created by the user making the request. |
billing_accounts_locations_saved_queries_create | INSERT | billingAccountsId, locationsId | Creates a new SavedQuery for the user making the request. |
folders_locations_saved_queries_create | INSERT | foldersId, locationsId | Creates a new SavedQuery for the user making the request. |
organizations_locations_saved_queries_create | INSERT | locationsId, organizationsId | Creates a new SavedQuery for the user making the request. |
projects_locations_saved_queries_create | INSERT | locationsId, projectsId | Creates a new SavedQuery for the user making the request. |
billing_accounts_locations_saved_queries_delete | DELETE | billingAccountsId, locationsId, savedQueriesId | Deletes an existing SavedQuery that was created by the user making the request. |
folders_locations_saved_queries_delete | DELETE | foldersId, locationsId, savedQueriesId | Deletes an existing SavedQuery that was created by the user making the request. |
organizations_locations_saved_queries_delete | DELETE | locationsId, organizationsId, savedQueriesId | Deletes an existing SavedQuery that was created by the user making the request. |
projects_locations_saved_queries_delete | DELETE | locationsId, projectsId, savedQueriesId | Deletes an existing SavedQuery that was created by the user making the request. |
billing_accounts_locations_saved_queries_patch | UPDATE | billingAccountsId, locationsId, savedQueriesId | Updates an existing SavedQuery. |
folders_locations_saved_queries_patch | UPDATE | foldersId, locationsId, savedQueriesId | Updates an existing SavedQuery. |
organizations_locations_saved_queries_patch | UPDATE | locationsId, organizationsId, savedQueriesId | Updates an existing SavedQuery. |
projects_locations_saved_queries_patch | UPDATE | locationsId, projectsId, savedQueriesId | Updates an existing SavedQuery. |
SELECT
examples
Lists the SavedQueries that were created by the user making the request.
SELECT
name,
description,
createTime,
displayName,
loggingQuery,
opsAnalyticsQuery,
updateTime,
visibility
FROM google.logging.saved_queries
WHERE foldersId = '{{ foldersId }}'
AND locationsId = '{{ locationsId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new saved_queries
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO google.logging.saved_queries (
foldersId,
locationsId,
displayName,
description,
loggingQuery,
opsAnalyticsQuery,
visibility
)
SELECT
'{{ foldersId }}',
'{{ locationsId }}',
'{{ displayName }}',
'{{ description }}',
'{{ loggingQuery }}',
'{{ opsAnalyticsQuery }}',
'{{ visibility }}'
;
- name: your_resource_model_name
props:
- name: name
value: string
- name: displayName
value: string
- name: description
value: string
- name: loggingQuery
value:
- name: filter
value: string
- name: summaryFields
value:
- - name: field
value: string
- name: summaryFieldStart
value: integer
- name: summaryFieldEnd
value: integer
- name: opsAnalyticsQuery
value:
- name: sqlQueryText
value: string
- name: createTime
value: string
- name: updateTime
value: string
- name: visibility
value: string
UPDATE
example
Updates a saved_queries
resource.
/*+ update */
UPDATE google.logging.saved_queries
SET
displayName = '{{ displayName }}',
description = '{{ description }}',
loggingQuery = '{{ loggingQuery }}',
opsAnalyticsQuery = '{{ opsAnalyticsQuery }}',
visibility = '{{ visibility }}'
WHERE
foldersId = '{{ foldersId }}'
AND locationsId = '{{ locationsId }}'
AND savedQueriesId = '{{ savedQueriesId }}';
DELETE
example
Deletes the specified saved_queries
resource.
/*+ delete */
DELETE FROM google.logging.saved_queries
WHERE foldersId = '{{ foldersId }}'
AND locationsId = '{{ locationsId }}'
AND savedQueriesId = '{{ savedQueriesId }}';