<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to automatically set tag value based on regex in Open Q&amp;A</title>
    <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300316#M39130</link>
    <description>&lt;P&gt;I have SAAS, hosted in the cloud, so I supposed its Gen3? But I do see the auto tagging functionality. It works when applying a constant value. So what do you mean : "it&amp;nbsp;&lt;SPAN&gt;does not have and will not have auto tagging functionality". Do you mean in particular the functionality to extract values based on regex?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you give more details on your solution:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{Host:DetectedName/....(....)}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Do I replace the "..." with something? With what?&lt;/P&gt;&lt;P&gt;When I put ( ) inside my regex to capture a group:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;^.{4}(.{4})&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;it gives me an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;Regex value is invalid: dangerous regex patterns are used: Only atomic groups are allowed. Atomic groups start with "(?&amp;gt;" and are non capturing and do not backtrack. Attention, this has an impact on the matching behavior but is much more performant.&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Wed, 03 Jun 2026 20:10:37 GMT</pubDate>
    <dc:creator>macotech</dc:creator>
    <dc:date>2026-06-03T20:10:37Z</dc:date>
    <item>
      <title>How to automatically set tag value based on regex</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300313#M39128</link>
      <description>&lt;P&gt;Our server names follow a naming convention : 4 letters company + 4 letters for the location (I simplified). What I am trying to do is to have a tag being automatically created for each server containing its location. There are around 50-70 possible locations, and there can be new ones created without notification. So I need a way which does not require having to change the Dynatrace config each time there’s a server with a new location in its name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example if the server name is BOBUCEB4, the location is CEB4, so I would like a tag called INT_LOCATION with the value CEB4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We installed oneAgent on the servers, so they are considered as Hosts in Dynatrace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I thought would be the logical to do is to create an entry in Settings/Tags/Automatically applied tags:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rule type=Monitored Entity&lt;/P&gt;&lt;P&gt;Rule applies to=Hosts&lt;/P&gt;&lt;P&gt;Condition&amp;nbsp;: hostname&amp;nbsp;contains regex '^.{4}.{4}'&lt;/P&gt;&lt;P&gt;Optional tag value: In this field, Dynatrace expects either a string or one pre-made variable. But there’s nothing about extracting part of the hostname or referencing the regex groups.&lt;/P&gt;&lt;P&gt;What I would have expected is to have a regex like this : ^.{4}(.{4})&amp;nbsp; &amp;nbsp;(ie with a capturing group for the location), and being able to reference it in the Optional tag value field. But that doesn’t seem to be possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So how do I achieve being able to create automatic tags and set the value based on part of the host name? Using either a regex or something else.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2026 19:09:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300313#M39128</guid>
      <dc:creator>macotech</dc:creator>
      <dc:date>2026-06-03T19:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically set tag value based on regex</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300314#M39129</link>
      <description>&lt;P&gt;Sure there is, however we need to distinguish beetween Dynatrace SaaS classic or Dynatrace Mananged and Dynatrace SaaS Gen3 which does not have and will not have auto tagging functionality.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;For auto tagging (Classic / Managed), you just use the extraction in the placeholder. So in your case it would be likely the following the the tag value:&lt;BR /&gt;{Host:DetectedName/....(....)}&lt;BR /&gt;&lt;BR /&gt;However, I would still consider adding the location as oneagent tag on the host level (you can reconfigure your oneagents remotely) and if you use automation to deploy oneagents, add it in the automation, so that this tag is manually added for each host.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2026 19:47:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300314#M39129</guid>
      <dc:creator>Julius_Loman</dc:creator>
      <dc:date>2026-06-03T19:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically set tag value based on regex</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300316#M39130</link>
      <description>&lt;P&gt;I have SAAS, hosted in the cloud, so I supposed its Gen3? But I do see the auto tagging functionality. It works when applying a constant value. So what do you mean : "it&amp;nbsp;&lt;SPAN&gt;does not have and will not have auto tagging functionality". Do you mean in particular the functionality to extract values based on regex?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you give more details on your solution:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{Host:DetectedName/....(....)}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Do I replace the "..." with something? With what?&lt;/P&gt;&lt;P&gt;When I put ( ) inside my regex to capture a group:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;^.{4}(.{4})&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;it gives me an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;Regex value is invalid: dangerous regex patterns are used: Only atomic groups are allowed. Atomic groups start with "(?&amp;gt;" and are non capturing and do not backtrack. Attention, this has an impact on the matching behavior but is much more performant.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 03 Jun 2026 20:10:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300316#M39130</guid>
      <dc:creator>macotech</dc:creator>
      <dc:date>2026-06-03T20:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically set tag value based on regex</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300317#M39131</link>
      <description>&lt;P&gt;Auto tags are part of Dynatrace classic - (which is technologically shared with Dynatrace Managed - the onprem solution). Dynatrace SaaS - Gen3 (new apps) based on data residing in Grail do not use the tags from auto-tagging rules. Dynatrace Classic will eventually be removed from SaaS so you should not in the end rely on this.&lt;BR /&gt;&lt;BR /&gt;If you are on SaaS, I would recommend using &lt;A href="https://docs.dynatrace.com/docs/ingest-from/dynatrace-oneagent/oneagent-attribute-enrichment" target="_blank"&gt;primary grail tags instead&lt;/A&gt;&amp;nbsp;.&lt;BR /&gt;&lt;BR /&gt;But back to your auto tag rule. In my example I used he the rule for you already (do represents any character), so it takes characters 5-8 from the host detected name.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2026 20:41:36 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-automatically-set-tag-value-based-on-regex/m-p/300317#M39131</guid>
      <dc:creator>Julius_Loman</dc:creator>
      <dc:date>2026-06-03T20:41:36Z</dc:date>
    </item>
  </channel>
</rss>

