Google Cloud Platform: Search Logs

📘

Availability

This workflow action is available on Business and Enterprise for Incident Management pricing plans. Contact the Sales Team to upgrade to an account with this action.

Description

Search for log entries in Google Cloud Platform Logging using Logging Query Language (LQL). This action lets you query GCP Cloud Logging directly from an Incident Workflow, filtering by LQL expression and time window, so you can pull relevant log entries into the incident timeline without leaving PagerDuty.

Prerequisites

  • A configured Google Cloud Platform Workflow Integration.
  • A GCP Cloud Connection created in PagerDuty.

Instructions

  1. If you have not done so, follow the instructions to Create an Incident Workflow.
  2. When the instructions prompt you to add actions, select this action.
  3. Enter the following Inputs and click Save.
  4. Continue following instructions to Publish the Workflow.
  5. When the action runs, you will see the Outputs listed below.

Inputs

📘

Field References

Fields with the {+} icon accept Field References, which can be useful for referencing incident data or outputs created in prior workflow steps. To add Field References, click {+}, or enter {{, and select relevant fields. Refer to the Field References article for more information.

NameDescription
Connection Input
(Required)
The GCP Cloud connection.
FilterLogging Query Language filter expression. Example: severity>=ERROR resource.type="k8s_container".
Start TimeStart of the search window. Pick a preset or enter an ISO 8601 timestamp (for example 2024-01-01T00:00:00Z).
End TimeEnd of the search window. Pick a preset or enter an ISO 8601 timestamp (for example 2024-01-01T01:00:00Z).
Result LimitMaximum number of log entries to return (1 to 1000).

Outputs

NameDescription
LogsArray of log entries returned from GCP Cloud Logging.
Log CountNumber of log entries returned.
Filter UsedThe filter expression sent to the API.
Time Range StartStart time used for the query.
Time Range EndEnd time used for the query.
Has More ResultsWhether more results are available via nextPageToken.
Next Page TokenToken for retrieving the next page of results.
ResultValue that shows if the action was successful or not. Either "Success" or "Failed."
Result SummaryBrief description of what the action did or if it failed.
ErrorBrief description that is populated if the action failed.
📘

Tips

Pagination: If Has More Results is true, use the Next Page Token output in a subsequent call to retrieve additional log entries beyond the Result Limit.

Examples

Example 1: Find Container Errors During an Incident

Set Filter to severity>=ERROR resource.type="k8s_container", Start Time to a preset such as the last hour, and leave End Time at its default. This returns container-level error and above log entries from the search window, which can be posted to the incident for the responding team to review.

Example 2: Paginate through a large result set

Set Result Limit to 1000 for the initial search. If the Has More Results output is true, use the Next Page Token output to configure a follow-up Search Logs step and retrieve the remaining log entries.