cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Service Naming using Regex

bill_scheuernst
DynaMight
DynaMight

I am stumped!  I am trying to setup a service naming rule using the Detected Service Name.  In this case, I would only like the bolded text - (/mothership).  How do I extract only this word using Regex?

 

I have tried -

  • ^[a-zA-Z0-9]*+
  • \/(?>.+)

For these attempts, I get close, but still have varying results.  I want to remove the slash and the () and only have the word. 

 

What I really want is this...

 

Detected Service Name - "Default Web Site:80 (/mothership)" >>>>> "mothership"

 

{Service:DetectedName]

Web Request Service; .NET

Detected service name contains regex

 

 

Dynatrace Certified Professional
5 REPLIES 5

ChadTurner
DynaMight Legend
DynaMight Legend

While this is very primitive, you could try (..........).$ but then again that would be static on the number of characters 

-Chad

dave_mauney
Dynatrace Champion
Dynatrace Champion

Have you considered just skipping the regex entirely and using the {Service:WebContextRoot} placeholder?

dave_mauney_0-1625070640730.png

You could then remove the slash with regex if really needed...

While a good answer, this solution doesn't completely solve the problem.  I'd like to clean up the default name which includes ":80 (/app)" or ":80, :443 (/app)", etc. and only have the name of the app pool or web request service.  The goal here is to clean up these extraneous characters as they are being imported into ServiceNow.

Dynatrace Certified Professional

What output are you looking for specifically? Can you provide another example? This screenshot shows a preview of how Dave's rule above would work - does this not match your initial request? 

ryan_ott_0-1627576275254.png

 

ACE Consultant, Dynatrace Services
Dynatrace Certified Professional

bill_scheuernst
DynaMight
DynaMight

Solution works.

 

bill_scheuernst_0-1627577698781.pngbill_scheuernst_1-1627577738175.png

 

Dynatrace Certified Professional

Featured Posts