0

I have a metric on Stackdriver, which filter my application logs. When a log pass by this filter, I want to send this logs by email, to fast act on this.

I created a policy in Stackdriver, added the metric and the label(which contains the information that I need) to the policy condition and added the email to notification chanels. But I receive emails with defaults title and body, not distinguing by label's metric type.

Is there any way to modify this email, adding the content of the label in title email?

Ps: I Tried put variables in the Documentation by this link https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars , but not working.

Ashik Mahbub
  • 156
  • 7

1 Answers1

0

I do believe the email notification you a receiving have GCP’s network configuring the email header, and therefore, the subject line. You can’t alter the header information from GCP and pipe in custom information, change headers or add complex scripts, etc.

Any variables you set will only affect the body of the message and not the title.

In my test, the alert email title and subject line cannot be altered. There is a “view details” link where it will bring you to your Stackdriver alert. The pertinent information on the alert, including the variables you mentioned, is in the body only.

If you want a programmatic way to set your notifications, you can look into webhooks which can be configured in addition to your email alert. There is a Google Blog post about this.

Ashik Mahbub
  • 156
  • 7