- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 10:13 AM
Hi
In an event rule, I'm trying to extract the name of a server from its FQDN (in the node field).
So I have ABCD.internal.server and I want to have ABCD what ever can be the other parts of the fqdn.
When I test the expression (\w+)\. on https://regex101.com/ it works very fine.
But once put in the "Transform and Compose Alert Output" tab of an event rule the regex returns nothing and a get a field with value "<<UNKNOWN>>" in the generated alert.
There is different expressions that can be used to extract the characters before the dot but none of them work once used in the alert rule.
Does any have already been able to do it?
Thanks
Solved! Go to Solution.
- Labels:
-
Event Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 03:57 AM
I've found the solution.
The difference between Servicenow and regex101 is that service now need to first select all the message then isolate the desired part.
so (\w+) select nothing then try to isolate the first word.
(\w+).+ works as it first select everything then isolate the first word.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 03:57 AM
I've found the solution.
The difference between Servicenow and regex101 is that service now need to first select all the message then isolate the desired part.
so (\w+) select nothing then try to isolate the first word.
(\w+).+ works as it first select everything then isolate the first word.