Skip to main content

recent_queries

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

Overview

Namerecent_queries
TypeResource
Idgoogle.logging.recent_queries

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOptional. Resource name of the recent query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/recentQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support)The QUERY_ID is a system generated alphanumeric ID.
lastRunTimestring (google-datetime)Output only. The timestamp when this query was last run.
loggingQueryobjectLogging query that can be executed in Logs Explorer or via Logging API. (id: LoggingQuery)
opsAnalyticsQueryobjectAnalytics query that can be executed in Log Analytics. (id: OpsAnalyticsQuery)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_recent_queries_listselectprojectsId, locationsIdpageToken, pageSize, filterLists the RecentQueries that were created by the user making the request.
organizations_locations_recent_queries_listselectorganizationsId, locationsIdpageToken, pageSize, filterLists the RecentQueries that were created by the user making the request.
folders_locations_recent_queries_listselectfoldersId, locationsIdpageToken, pageSize, filterLists the RecentQueries that were created by the user making the request.
billing_accounts_locations_recent_queries_listselectbillingAccountsId, locationsIdpageToken, pageSize, filterLists the RecentQueries that were created by the user making the request.

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
billingAccountsIdstring
foldersIdstring
locationsIdstring
organizationsIdstring
projectsIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Lists the RecentQueries that were created by the user making the request.

SELECT
name,
lastRunTime,
loggingQuery,
opsAnalyticsQuery
FROM google.logging.recent_queries
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND pageToken = '{{ pageToken }}'
AND pageSize = '{{ pageSize }}'
AND filter = '{{ filter }}';