Define tags based on environment variables
Dynatrace provides the ability to define tags as in environment variables for processes and process groups.
Defining tags in the environment itself has its uses. However it's not recommended as a general purpose solution, as it is rather cumbersome and requires a lot of preplanning. It also makes it hard to make changes later. Therefore, you will have to use it with caution.
It's recommended that you define additional metadata at the deployed system. Typically, you should think about additional metadata and standard metadata and not about tags (i.e, labels). You should use the environment variable
DT_CUSTOM_PROP to define your metadata. This variable needs to be present at the application startup. For WebSphere, you can do this in the WebSphere console in the JVM section. For Tomcat and others, simply define it as part of the startup script.
This enables you to use automated tagging rules, based on existing or custom metadata, to define your filter sets for charts, alerting, and more. These tags and rules can be changed and adapted any time and will apply almost immediately without any change to the monitored environment or applications.
Define tags as environment variables
You can define an environment variable called
DT_TAGS on the process or host level. The format of the variable is simple. The variable can contain simple strings or key/value pairs (for example,
DT_TAGS=MikesStuff easyTravel=Mike). As you can see in the Windows process example below, you can define multiple tags. Spaces are used to separate tag values.
To customize the process group of IIS, you need to define an environment variable that you can use within the scope of a rule. To set up an environment variable in IIS version 10 or later, see Environment variables.
Set up an environment variable for IIS versions earlier than 10
To set up an environment variable in IIS versions earlier than 10, follow the instructions below.
Configure the Advanced Settings for Application Pool.
Set the Load User Profile as True.
At the command prompt with admin rights, enter
Open the Registry and navigate to
Launch the application to initialize the AppPool (or set the AppPool Start Mode to Always Running), refresh
hivelistand look for the new entries.
C:\Usersfor the name of the user who runs the AppPool.
In the registry navigate to the ID of the user under
HKEY_USERSand add a String Value named
Add the value you want with spaces between the key/value pairs.
Restart IIS one more time and check Dynatrace process for environmental metadata.
To customize process grouping for Windows services, you'll need to create a key called Environment of type
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<servicename>. The value of the Environment key may contain multiple entries like in the following example:
Note: Applying tags to hosts (instead of thoughtfully setting up environment variables as explained here) isn't recommended. The same applies to applications and processes. For details on setting up the
DT_CUSTOM_PROP environment variable for Tomcat or WebSphere application metadata, Kubernetes annotations for Kubernetes-based deployments, or AWS tagging, see Application metadata & tagging.
Filter entities based on environment variables
In the Dynatrace UI, the example environment variable shown above results in new filters being displayed on the related process overview page (see below). Process group overview pages display the sum of all the tags of all processes in the group.
This feature is currently only available for processes that are deep monitored via OneAgent (Java, Apache Webserver, NGINX, .NET, Node.js, PHP, Go, and IIS).