0

I am using a Log Match Condition to trigger a GCP alert policy which contains a string match for the text in my firebase function log, e.g.

textPayload =~ "^My Trigger: (.*)$"

This is working a treat, but I really want to trigger different incidents for different matches within the regex group. For example, "My Trigger: ABC" should be a different incident to "My Trigger: XYZ".

Is there a way to achieve this with GCP alert policies?

And as a bonus question!... I'd love to include the textPayload (or even better the regex match) in the alert documentation but can not see a way to do that. I also have more structured data available in the JSON payload in the logging, but am not sure if it is possible to access that either. Maybe I need to make a metric based on this structured data?

Thank you :)

Fringley
  • 876
  • 1
  • 8
  • 6

1 Answers1

0

Just want to check what do you mean by "different"? Do you want the description of the alert include the value of the Regex group match? If you do, it is not possible. However, you get a link to the logs that caused the incident and can easily discover the needed information.

An alternative would be to create log-based metrics and capture the value of that regex group as a label. Then you should be able to create a metric-based alert and to get the value as part of the info there.

Leo Y
  • 659
  • 7
  • 22
  • Hi! By different I’m referring to triggering separate incidents based on values in the regex group. I was going to try a log based metric next as that seems the next logical step – Fringley Sep 15 '22 at 07:07
  • In that case, the above solution should apply. – Leo Y Sep 16 '22 at 04:39