Using Console
Using CLI
PROJECT_OWNERSHIP_CHANGE_ALERTS
that sends log entries matching the specified filter to a Pub/Sub topic named gcp-logging-alerts
.
gcp-logging-alerts
topic:
PROJECT_OWNERSHIP_CHANGE_ALERTS
for the gcp-logging-alerts
topic with an acknowledgement deadline of 30 seconds and no expiration period.
gcp-logging-alerts
topic:
process_project_ownership_change_alerts
that processes log entries sent to the gcp-logging-alerts
topic. The function is triggered by messages sent to the topic and has a memory limit of 128MB, a timeout of 30 seconds, and uses the env.yaml
file to set environment variables.
Using Python
GOOGLE_APPLICATION_CREDENTIALS
environment variable to the path of the service account key file.
google.cloud.monitoring_v3.MetricServiceClient
class to enable the “Project Ownership Change Log Alerts”. Use the create_alert_policy
method to create a new alert policy for the metric gce_instance_update
.