Unable to remove certain things in alert email subject and email body alerted using log based policy

Hi,

I am using python code to create log based policy for mail alerting. In this policy, I am even able to extract log information using "label_extractor" and pass it in "content" key under "documentation" section of policy json file which is used for creating policy.

Problems I am facing:-

1) In log based policy, I know that the "policy name" will be the subject of the email. Suppose I want the subject of the mail alert to be "Model drift", I will use the same name for policy name while creating policy. But in actual email subject, I am seeing additional writings as shown in the figure below. Is there any way to display ONLY "Model drift" as subject of the mail?

naveenthomas_0-1672248181921.png

2) As you know that I am using log_extractor to capture log messages and passing it in the body of the email alert. I am able to do that successfully but the same log extract information is showing inside "Log match condition with labels {msg:xxxxxxxxxxx}" which is inappropriate. Figure is shown below. How to remove this message?

naveenthomas_1-1672248750915.png

 

 

2 8 785
8 REPLIES 8

Unfortunately it's not possible to customize the contents of the notification body. With that said, coming in 2023 you'll be able to customize the subject line and we can share more in this thread when it's available. Stay tuned. 

ok. I would like to have the policy name to take label_extractor values also. (Since policy name becomes subject of the alerted mail) . So that subject of the mail alert changes dynamically based on the log it identifies for alerting.

Hi,

I've pushed feature request for something similar to your needs. You can track it here:
https://issuetracker.google.com/issues/261302137

best,
DamianS

ok thank you

Always able to help:)
If you can mark either my  or @agoldstein's reply as solution, it would be super cool. Thanks 😉

best,
DamianS

agoldstein will be sharing update in this thread when it's available. So I will wait till then to close this thread

 

 

@agoldstein It's 2024 now, is it possible to change the subject line? I'd love to be able to set a custom one different based on the alert notification and the alert closure. Thank you!

@agoldstein it's 2024. Is this possible now? I'd love to set different subjects based on the alert status (alerted/resolved)