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

Substring of a placeholder

carlos_ortega
Organizer

Hi,

 

At this moment, Dynatrace is recognizing some variables and they are saved as placeholders to be used at tag rules or request naming rules. However, I would like to know how we can get a part of the value.

 

for example, i have the following variable:

 

DockerStrippedname=docker/microservice

 

I would like to get the value of "microservice" as the content of the placeholder to be used in the rule. I don't know if it could be possible to add a expresion into the placeholder definition {ProcessGroup:dockerstrippedname} to get only this part.

 

is it possible?

thanks,

Carlos

4 REPLIES 4

AlexOsbourn
Dynatrace Helper
Dynatrace Helper

When using placeholders, if you specify a forward slash (/) before the closing curly-bracket, you can use regex immediately after it. For example:

 

If your value is  DockerStrippedname=docker/microservice and you want to capture everything after the =, you would enter your placeholder like:


{ProcessGroup:dockerstrippedname/^[^=]*=(.*?$)} 

(I'm not too great at regex so there is probably a better way to do that).

techean
Dynatrace Champion
Dynatrace Champion

Try something like, works !

Tag:

{ProcessGroup:dockerstrippedname/^(.*?)_}

 

Condition:

^.*?_

 

KG

Hi,

 

Thanks a lot!, the following expresion gives me the solution:

 

/.+\/([^\/]*+)

 

thanks!

Good  👍!

KG

Featured Posts