Robert Sliwinski
05/15/2024, 7:37 AMbody CONTAINS .service: Failed with result and group this by hostname.
It works somehow for getting a count of messages, but it would be great to actually use the name of the failed service in the Alert/Notifications. Do we need to add some regex magic to the body of the alert or is there a even more elegant way to achieve such an alert?
serviceA, serviceB, serviceC have failed on hostA
Srikanth Chekuri
05/15/2024, 8:33 AMRobert Sliwinski
05/15/2024, 8:36 AMappname and it's always systemd.
That does not help that much.Srikanth Chekuri
05/15/2024, 8:37 AMRobert Sliwinski
05/15/2024, 9:10 AMsystemd that orchestrates those and marks them failed.
Basically I have the message object that was parsed and has the service-name in it, so [a-zA-Z0-9-_]+(?=\.) would match the service name perfect for the messages:
"serviceA.service: Failed with result 'exit-code'."Robert Sliwinski
05/15/2024, 9:14 AMmatch(message.field, '[a-zA-Z0-9-_]+(?=\.)')Robert Sliwinski
05/15/2024, 10:08 AMservicename that I can use in my alerts.
I'm near being fully happy with the solution, but: How do I need to specify the servicename in the Alert to be picked up?Srikanth Chekuri
05/15/2024, 10:53 AMHow do I need to specify theI didn't understand the question.in the Alert to be picked up?servicename
Robert Sliwinski
05/16/2024, 9:01 AMSrikanth Chekuri
05/16/2024, 2:07 PM{{.Labels.servicename}}