This page describes how to view platform logs generated by SaaS Runtime. Platform logs in Google Cloud are service-specific logs, which you can use to debug and troubleshoot issues, and better understand the Google Cloud services you're using.
For details about supported SaaS Runtime platform logs, see Google Cloud platform logs. For more information about understanding the data in the platform log tables, see Log entry structure.
Before you begin
- In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
- Ensure that billing is enabled for your Google Cloud project.
- Enable the SaaS Runtime API.
- To get the permissions that you need to view logs and create alerts, ask
your administrator to grant you the following Identity and Access Management (IAM) roles on your project:
- Logs Viewer (
roles/logging.viewer) - Monitoring Editor (
roles/monitoring.editor)
- Logs Viewer (
Create log-based alerts
To create a log-based alert, you build a query in the Logs Explorer that returns the log entries for which you want to be alerted, and then you configure the alert policy.
In the Google Cloud console, go to the Logs Explorer page.
In the query editor, enter a query to filter for the chosen log entries. See the following sections for example queries.
Click Create alert.
Enter a name and description for the alert policy.
Configure the alert details, including notification channels.
Click Save alert.
For detailed instructions, see Create a log-based alert.
Example queries for platform logs
This section provides example queries for common alert scenarios based on SaaS Runtime platform logs.
SaaS operations alerts
To create an alert for when a unit provisioning operation fails, use the query:
protoPayload.methodName="google.cloud.saasplatform.saasservicemgmt.v1beta1.SaasDeployments.CreateUnitOperation"
protoPayload.response.state="UNIT_OPERATION_STATE_FAILED"
To create an alert for when a unit provisioning operation reaches a terminal state (succeeded, failed, or cancelled), use the query:
jsonPayload.@type="type.googleapis.com/google.cloud.saasservicemgmt.logging.v1.UnitOperationLog"
AND (jsonPayload.unit_operation_state="UNIT_OPERATION_STATE_SUCCEEDED" OR jsonPayload.unit_operation_state="UNIT_OPERATION_STATE_FAILED" OR jsonPayload.unit_operation_state="UNIT_OPERATION_STATE_CANCELLED")
AND jsonPayload.unit_operation_type="PROVISION"
Rollout alerts
To create an alert if a regional rollout enters a PAUSED or FAILED state for
a reason other than a user action, use the query:
jsonPayload.@type="type.googleapis.com/google.cloud.saasservicemgmt.logging.v1.RolloutLog"
AND (jsonPayload.current_state="PAUSED" OR jsonPayload.current_state="FAILED")
AND jsonPayload.reason!="USER_PAUSE"
AND jsonPayload.root_rollout_id != resource.labels.rollout_id
To create an alert if a global rollout enters a PAUSED or FAILED state, use
the query:
jsonPayload.@type="type.googleapis.com/google.cloud.saasservicemgmt.logging.v1.RolloutLog"
AND (jsonPayload.current_state="PAUSED" OR jsonPayload.current_state="FAILED")
AND jsonPayload.root_rollout_id == resource.labels.rollout_id
To create a log alert for when a rollout enters a PAUSED state (because
SaaS Runtime has identified the rollout as unhealthy), or a FAILED
state, use the query:
logName:"rollout_events"
(jsonPayload.currentState="PAUSED" jsonPayload.reason="SYSTEM_PAUSE")
OR
jsonPayload.currentState="FAILED
To create a log alert for rollout state metrics when a rollout enters a PAUSED
state (because SaaS Runtime has identified the rollout as unhealthy),
or a FAILED state, use the query:
saasservicemgmt_googleapis_com:rollout_state
{state_name="PAUSED", reason="SYSTEM_PAUSE"}
OR
saasservicemgmt_googleapis_com:rollout_state{state_name="FAILED"}
What's next
- For more information about supported SaaS Runtime platform logs, see Google Cloud platform logs.
- To understand the data in platform log tables, see Log entry structure.
- Learn more about SaaS Runtime audit logs.