[英]Google Cloud logging, sending slack notifications only for newly appeared errors
need to send alerts to slack using google cloud logging but send the alert only once, because the alert may be repeated multiple times and this will cause a lot of miss.需要使用谷歌云日志向 slack 发送警报,但只发送一次警报,因为警报可能会重复多次,这会导致很多错过。
I think to resolve your issue, in addition to the filter for the log based metric
, you should add labels
with extractors.我认为要解决您的问题,除了log based metric
的过滤器之外,您还应该添加带有提取器的labels
。
The metric is checked for each labels and not once.为每个标签检查指标,而不是一次。
In my example I added a log based metric
with a filter for some error types in Cloud Composer
.在我的示例中,我为Cloud Composer
中的某些错误类型添加了一个log based metric
和过滤器。 In order to increment my metric and make be unique, I also added labels on the current Airflow
task id
and execution date
.为了增加我的指标并使其独一无二,我还在当前Airflow
task id
和execution date
上添加了标签。
Then I just need to create an alerting policy on this log based metric with a treshold.然后我只需要在这个基于日志的指标上创建一个警报策略,并设置一个阈值。
If I don't add labels and extractor, my alert is fired only once.如果我不添加标签和提取器,我的警报只会触发一次。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.