henryw374
henryw374

Reputation: 387

how to create alert per error in stackdriver

Having created log-based metrics in cloud console, I then want to create alerts so that every time there is a new matching log entry, the alert triggers.

In trying to create a suitable metric, the most likely looking options seem to be threshold or rate of change, but I don't think either will work for a policy of 1 log message => 1 alert.

Help appreciated.

Upvotes: 11

Views: 3181

Answers (3)

SANN3
SANN3

Reputation: 10069

With log-based alerts, we can create alerts from the logs, incident will be creatied for each matching entry.

https://cloud.google.com/blog/products/operations/create-logs-alerts-preview

Upvotes: 0

dstanco
dstanco

Reputation: 61

You can use another alert triggering software (like PagerDuty) which is pinged by emails sent by Stackdriver. PagerDuty is able to filter all those emails that has the word RESOLVE in its subject. They can be absolutely thrown away in our case if you'd like to avoid autoresolving. Of course Stackdriver and PagerDuty alerts will diverge from each other (states will be inconsistent) but you should consider PD as single source of truth this time. It could be a possible workaround.

Upvotes: 0

Amir Hermelin
Amir Hermelin

Reputation: 216

Yes, today the only way to alert on the log message is to create a threshold condition on the log metric with a very small threshold (0.001) and a duration of 1 minute. Thanks for using Stackdriver.

Upvotes: 6

Related Questions