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

Pro Tip - Using Regex for Dynamic Tagging

DynaMight Legend
DynaMight Legend

Depending on the size of your environment, odds are you are using automatic tagging. Automatic tagging is great but also can have its downfalls. Over the last several updates, Dynatrace has increased the functionality of its tagging. 


- Tagging Entity Names 

With larger organizations adopting new technologies and methodologies, its important to provide tags on these entities. For example. Lets say we have our Application "EasyTravel" but your organization is shifting from being hosted on VMWare to AWS. As a result, you have two different EasyTravel Apps now "AWS EasyTravel" and "VM EasyTravel" you can use custom regex to pull the dynamic values of the Application Names. I like to use to test all my regex: 


Then we just supply that in: by adding the /<RegexCode>}


Once you create and save this rule, it will apply to the entire scope. You can also use this for Environment as well by just updating your Regex:  



Using dynamic regex tagging allows you to create one rule that will provide the targeted value of a set entities across the entire scope! So no more single rules stating if the name contains NP1, tag it with NP1 and so on. 


The possibilities are endless and can be used for Hosts, Processes, Services, Applications, Synthetics, Properties and so much more! 



DynaMight Legend
DynaMight Legend

Important Note: Naming standards do come in handy as it will ensure the data you are looking for is in the same location each and every time, thus allowing your Regex to work 100%


Good stuff Chad

Hi Chad, I have to admit that you are an iconic person on our Team for keeping us abreast with Dynatrace, assisting and answering our questions as always! Thank you and it's very much appreciated!

DynaMight Champion
DynaMight Champion

Great stuff Chad! 👍

Thanks @larry_roberts :dynaspin:


You are awesome, Chad!

DynaMight Pro
DynaMight Pro

great writeup.  This has me thinking about some of our existing configuration.  Might be time for improvement.


Dynatrace Champion
Dynatrace Champion

This is a fantastic tip, I have been using/suggesting this for a while now and I came here to post about it on the community as a tip but found you had already beaten me to it by a whole year! 😁

I have also found it to be really helpful for tagging based on the host groups if you can decide on a naming scheme for host groups. You can then propagate environments, locations and other tags throughout your environment making it easier to navigate!


Hey Chad, 

Where can I find this screen to apply the regex and can I use the same regex to different process group?

To be more directly, with an Automatically Tag I can't set to apply the same "rule tag" to services but from different processes, even if I create different condition. Because today isn't an option to use the "or" operator... so since it always use "and", i can only set one process group by rule. So my idea is to add the same regex for those process groups and use a single condition with this regex as value to apply to all services with the same rule.

You can see all the Dynamic tag values from the following segment of the Auto Tag page: 


Granted the 'code' for process groups will not apply to services, unless you leverage one of the tag options to apply to underlying services/hosts: 






After some learning about regex I understood how to use it...

Basically I could apply a tag value in services running on different process group using "contains regex", it allows me to add multiple regex separating by pipes "|", it worked as an "or" operator in the same rule.

It saved me a lot of time.

Thank you Chad, your tip helped me a lot. It brought me to the solution!

Featured Posts