<?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 Create a variable with the values of a specific tag in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Create-a-variable-with-the-values-of-a-specific-tag/m-p/218061#M135</link>
    <description>&lt;DIV class="p-rich_text_section"&gt;I would like to create a variable that contains the values of a specific tag for the hosts. I'm trying to create the query to get these values.&lt;BR /&gt;Basically if the tag is called Business Application and the values are X, Y, Z I would like to get X, Y and Z.I tried with this but it gives me all the tags for the different hosts:&lt;/DIV&gt;
&lt;PRE class="c-mrkdwn__pre" data-stringify-type="pre"&gt;fetch dt.entity.host
| summarize count = count(), by:{tags}
| sort count desc
| fields tags&lt;/PRE&gt;
&lt;DIV class="p-rich_text_section"&gt;I guess you would need to parse the individual tags and separate them if they are key:value.&lt;BR /&gt;How could I create this query?&lt;/DIV&gt;</description>
    <pubDate>Fri, 14 Jul 2023 10:59:06 GMT</pubDate>
    <dc:creator>elenaperez</dc:creator>
    <dc:date>2023-07-14T10:59:06Z</dc:date>
    <item>
      <title>Create a variable with the values of a specific tag</title>
      <link>https://community.dynatrace.com/t5/DQL/Create-a-variable-with-the-values-of-a-specific-tag/m-p/218061#M135</link>
      <description>&lt;DIV class="p-rich_text_section"&gt;I would like to create a variable that contains the values of a specific tag for the hosts. I'm trying to create the query to get these values.&lt;BR /&gt;Basically if the tag is called Business Application and the values are X, Y, Z I would like to get X, Y and Z.I tried with this but it gives me all the tags for the different hosts:&lt;/DIV&gt;
&lt;PRE class="c-mrkdwn__pre" data-stringify-type="pre"&gt;fetch dt.entity.host
| summarize count = count(), by:{tags}
| sort count desc
| fields tags&lt;/PRE&gt;
&lt;DIV class="p-rich_text_section"&gt;I guess you would need to parse the individual tags and separate them if they are key:value.&lt;BR /&gt;How could I create this query?&lt;/DIV&gt;</description>
      <pubDate>Fri, 14 Jul 2023 10:59:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Create-a-variable-with-the-values-of-a-specific-tag/m-p/218061#M135</guid>
      <dc:creator>elenaperez</dc:creator>
      <dc:date>2023-07-14T10:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create a variable with the values of a specific tag</title>
      <link>https://community.dynatrace.com/t5/DQL/Create-a-variable-with-the-values-of-a-specific-tag/m-p/218062#M136</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/58054"&gt;@elenaperez&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to get a list of unique tag values for the tag "Business Application" this dql query should work for you&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch dt.entity.host
| expand tags
| summarize tags = collectDistinct(tags)
| expand tags
| parse tags, """((LD:tag (!&amp;lt;&amp;lt;'\\' ':') LD:value)|LD:tag)"""
| fields tag = replaceString(tag,"""\:""", ":"), value = replaceString(value, """\:""", ":")
| filter toString(tag) == "Business Application"
| fields value&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Sini&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 11:10:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Create-a-variable-with-the-values-of-a-specific-tag/m-p/218062#M136</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2023-07-14T11:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create a variable with the values of a specific tag</title>
      <link>https://community.dynatrace.com/t5/DQL/Create-a-variable-with-the-values-of-a-specific-tag/m-p/218064#M137</link>
      <description>&lt;P&gt;Thank you so much, it is exactly what I was looking for! Super helpful&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 11:25:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Create-a-variable-with-the-values-of-a-specific-tag/m-p/218064#M137</guid>
      <dc:creator>elenaperez</dc:creator>
      <dc:date>2023-07-14T11:25:43Z</dc:date>
    </item>
  </channel>
</rss>

