<?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 How to Retrieve All Entities with a Specific Tag Using DQL in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/How-to-Retrieve-All-Entities-with-a-Specific-Tag-Using-DQL/m-p/276536#M2033</link>
    <description>&lt;P&gt;Dear DQL Masters,&lt;/P&gt;&lt;P&gt;I have the following use case:&lt;/P&gt;&lt;P&gt;- I need to know all the entities that have a tag using DQL. For example I need to know all the entities, no matter if they are hosts, services, process groups, synthetics... and that contain a specific tag.&lt;/P&gt;&lt;P&gt;- I have created the following DQL:&lt;/P&gt;&lt;P&gt;fetch dt.entity.host&lt;BR /&gt;| fieldsAdd tags&lt;BR /&gt;| expand tags&lt;BR /&gt;| filter contains(toString(tags), "APP:TEST")&lt;BR /&gt;| parse tags, "ld:key ':' ld:tag_value"&lt;BR /&gt;| lookup [fetch dt.entity.service], lookupField: id, prefix:"lookup.affected.entity.services"&lt;BR /&gt;| lookup [fetch dt.entity.application], lookupField: id, prefix:"lookup.affected.entity.applications"&lt;BR /&gt;| lookup [fetch dt.entity.mobile_application], lookupField: id, prefix:"lookup.affected.entity.mobile"&lt;BR /&gt;| lookup [fetch dt.entity.custom_application], lookupField: id, prefix:"lookup.affected.entity.customapplication"&lt;BR /&gt;| lookup [fetch dt.entity.cloud_application], lookupField: id, prefix:"lookup.affected.entity.cloudapplication"&lt;BR /&gt;| lookup [fetch dt.entity.synthetic_test], lookupField: id, prefix:"lookup.affected.entity.synthetictest"&lt;BR /&gt;| lookup [fetch dt.entity.multiprotocol_monitor], lookupField: id, prefix:"lookup.affected.entity.multiprotocolmonitor"&lt;BR /&gt;| lookup [fetch dt.entity.custom_device], lookupField: id, prefix:"lookup.affected.entity.customdevices"&lt;BR /&gt;| lookup [fetch dt.entity.environment], lookupField: id, prefix:"lookup.affected.entity.environment"&lt;/P&gt;&lt;P&gt;But in the results it only shows me entities type hosts.&lt;/P&gt;&lt;P&gt;Is there any way to get all the entities that have this label using DQL?&lt;/P&gt;&lt;P&gt;Thanks a lot for your time&lt;/P&gt;</description>
    <pubDate>Tue, 06 May 2025 11:11:47 GMT</pubDate>
    <dc:creator>VictorRuiz</dc:creator>
    <dc:date>2025-05-06T11:11:47Z</dc:date>
    <item>
      <title>How to Retrieve All Entities with a Specific Tag Using DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-Retrieve-All-Entities-with-a-Specific-Tag-Using-DQL/m-p/276536#M2033</link>
      <description>&lt;P&gt;Dear DQL Masters,&lt;/P&gt;&lt;P&gt;I have the following use case:&lt;/P&gt;&lt;P&gt;- I need to know all the entities that have a tag using DQL. For example I need to know all the entities, no matter if they are hosts, services, process groups, synthetics... and that contain a specific tag.&lt;/P&gt;&lt;P&gt;- I have created the following DQL:&lt;/P&gt;&lt;P&gt;fetch dt.entity.host&lt;BR /&gt;| fieldsAdd tags&lt;BR /&gt;| expand tags&lt;BR /&gt;| filter contains(toString(tags), "APP:TEST")&lt;BR /&gt;| parse tags, "ld:key ':' ld:tag_value"&lt;BR /&gt;| lookup [fetch dt.entity.service], lookupField: id, prefix:"lookup.affected.entity.services"&lt;BR /&gt;| lookup [fetch dt.entity.application], lookupField: id, prefix:"lookup.affected.entity.applications"&lt;BR /&gt;| lookup [fetch dt.entity.mobile_application], lookupField: id, prefix:"lookup.affected.entity.mobile"&lt;BR /&gt;| lookup [fetch dt.entity.custom_application], lookupField: id, prefix:"lookup.affected.entity.customapplication"&lt;BR /&gt;| lookup [fetch dt.entity.cloud_application], lookupField: id, prefix:"lookup.affected.entity.cloudapplication"&lt;BR /&gt;| lookup [fetch dt.entity.synthetic_test], lookupField: id, prefix:"lookup.affected.entity.synthetictest"&lt;BR /&gt;| lookup [fetch dt.entity.multiprotocol_monitor], lookupField: id, prefix:"lookup.affected.entity.multiprotocolmonitor"&lt;BR /&gt;| lookup [fetch dt.entity.custom_device], lookupField: id, prefix:"lookup.affected.entity.customdevices"&lt;BR /&gt;| lookup [fetch dt.entity.environment], lookupField: id, prefix:"lookup.affected.entity.environment"&lt;/P&gt;&lt;P&gt;But in the results it only shows me entities type hosts.&lt;/P&gt;&lt;P&gt;Is there any way to get all the entities that have this label using DQL?&lt;/P&gt;&lt;P&gt;Thanks a lot for your time&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 11:11:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-Retrieve-All-Entities-with-a-Specific-Tag-Using-DQL/m-p/276536#M2033</guid>
      <dc:creator>VictorRuiz</dc:creator>
      <dc:date>2025-05-06T11:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to Retrieve All Entities with a Specific Tag Using DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-Retrieve-All-Entities-with-a-Specific-Tag-Using-DQL/m-p/276539#M2034</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;here's how I did it, you should use :&lt;/P&gt;&lt;P&gt;| expand tags&lt;/P&gt;&lt;P&gt;| filter matchesvalue(tags, ‘Yourtags’)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here's an example of what I did&lt;/P&gt;&lt;PRE&gt;fetch events &lt;BR /&gt;| filter matchesvalue(event.description, "*Host shutdown*") or matchesvalue(event.description, "*Host gracefully rebooted*")&lt;BR /&gt;| lookup [fetch dt.entity.host], sourceField:dt.entity.host, lookupField:id&lt;BR /&gt;| fieldsAdd tags = lookup.tags&lt;BR /&gt;| fieldsAdd lookup.hostGroupName&lt;BR /&gt;| expand tags&lt;BR /&gt;| filter matchesValue(tags,"Function:BDD-MSSQL") or matchesValue(tags,"[Environment]Function:EDITION") or matchesValue(tags,"[Environment]Function:WEB") or matchesValue(tags,"Function:APP")&lt;BR /&gt;| parse tags, """DATA * "Function:"LD:"Name""""&lt;BR /&gt;| fields event.start, event.end, Name, event.description&lt;BR /&gt;| sort Name,event.description asc&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Etienne1_0-1746532619688.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27861iEDD6594B5ADF2B97/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Etienne1_0-1746532619688.png" alt="Etienne1_0-1746532619688.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 11:58:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-Retrieve-All-Entities-with-a-Specific-Tag-Using-DQL/m-p/276539#M2034</guid>
      <dc:creator>Etienne1</dc:creator>
      <dc:date>2025-05-06T11:58:51Z</dc:date>
    </item>
  </channel>
</rss>

