29 Jun 2022 01:31 PM - last edited on 29 Jun 2022 01:43 PM by MaciejNeumann
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
Solved! Go to Solution.
30 Jun 2022 04:15 PM
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).
30 Jun 2022 05:56 PM
Try something like, works !
Tag:
{ProcessGroup:dockerstrippedname/^(.*?)_}
Condition:
^.*?_
01 Jul 2022 07:17 AM
Hi,
Thanks a lot!, the following expresion gives me the solution:
/.+\/([^\/]*+)
thanks!