user1403505
user1403505

Reputation: 1005

Create an alerting policy based on pub/sub pull subscription

I am new to alert policy creation in Google Cloud. I have set up a GKE cluster and enabled upgrade notifications to publish a message to Pub/Sub topic whenever cluster gets upgraded.

The Pub/Sub uses pull subscription model. Now whenever a message is published to the pub/sub I need to set-up an alerting policy to pull the message and send an email containing the message content to a distribution channel via email. I need to achieve it without writing Cloud function only through alerting policy.

How can I achieve this?

Upvotes: 0

Views: 987

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75735

Alert policy can't read the PubSub messages. The product listen to the logs and when the combination match a policy rule, an action (an alert) is generated.

If you need to send an email on the PubSub message content, you MUST read it (with Cloud Functions, Cloud Run, App Engine or whatever) and:

  • Either send directly the email with the message content
  • Or, if you want to use Cloud Alerting, publish a special log format (put a specific key word in the log that you write along to the message content), to let Cloud Alerting detect the log entries and send email alert with the log trace (including your message content)

Upvotes: 1

Related Questions