<?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: host name in services running on host dlq in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/280732#M2249</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/19769"&gt;@marco_irmer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your inputs, I've tried the suggested DQL Query but it didn't work, what might be the missing part.&lt;BR /&gt;&lt;BR /&gt;fetch dt.entity.service&lt;BR /&gt;| expand dt.entity.host=runs_on[dt.entity.host]&lt;BR /&gt;| fieldsAdd host_name = entityName(dt.entity.host) // Add the host name&lt;BR /&gt;| summarize host_name = collectArray(host_name), by:{id,entity.name} // summarize to create a host_names array&lt;BR /&gt;| fieldsAdd entityAttr(dt.entity.host, "tags")&lt;BR /&gt;| filter in(id, classicEntitySelector(concat("type(service), tag(\"Env:" , abc", \")")))&lt;BR /&gt;| filter in(id, classicEntitySelector(concat("type(service), tag(\"Env:" , xyz", \")")))&lt;BR /&gt;&lt;BR /&gt;BR,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jul 2025 14:56:21 GMT</pubDate>
    <dc:creator>Peter_Youssef</dc:creator>
    <dc:date>2025-07-03T14:56:21Z</dc:date>
    <item>
      <title>Host name in services running on host dql</title>
      <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/279717#M2221</link>
      <description>&lt;P&gt;I have a dql that relates me the services and the hosts on which it is running, but it only gives me the id of the hosts and I would like to have the name of the host instead of the id.&lt;/P&gt;
&lt;P&gt;This is the dql:&lt;/P&gt;
&lt;P&gt;fetch dt.entity.service&lt;BR /&gt;| expand dt.entity.host=runs_on[dt.entity.host]&lt;BR /&gt;| fieldsAdd entityAttr(dt.entity.host, "tags")&lt;BR /&gt;| filter in(id, classicEntitySelector(concat("type(service), tag(\"APP:", $APPLICATION, "\")")))&lt;BR /&gt;| filter in(id, classicEntitySelector(concat("type(service), tag(\"ENVIRONMENT:", $ENTORNO, "\")")))&lt;BR /&gt;| dedup id&lt;BR /&gt;| fields entity.name, serviceType, entity.customized_name, id, runs_on[dt.entity.host]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pablo2_0-1750243816491.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28555i2A689593F7A00682/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pablo2_0-1750243816491.png" alt="Pablo2_0-1750243816491.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found this in the documentation but I've tried it and it doesn't work for me.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.dynatrace.com/docs/discover-dynatrace/platform/grail/querying-monitored-entities" target="_self"&gt;https://docs.dynatrace.com/docs/discover-dynatrace/platform/grail/querying-monitored-entities&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 11:08:32 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/279717#M2221</guid>
      <dc:creator>Pablo2</dc:creator>
      <dc:date>2025-07-11T11:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: host name in services running on host dlq</title>
      <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/279719#M2222</link>
      <description>&lt;P&gt;Hi Pablo,&lt;/P&gt;&lt;P&gt;Adding this instruction&lt;/P&gt;&lt;P&gt;&lt;EM&gt;| lookup sourceField:runs_on[dt.entity.host], lookupField:id, fields:{host.name = entity.name}, [ fetch dt.entity.host ]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;you can get the hostname instead of the hostid.&lt;/P&gt;&lt;P&gt;Try to change the DQL adding this line. Somethig like this maybe:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;fetch dt.entity.service&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| expand dt.entity.host=runs_on[dt.entity.host]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;| lookup sourceField:runs_on[dt.entity.host], lookupField:id, fields:{host.name = entity.name}, [ fetch dt.entity.host ]&lt;BR /&gt;&lt;SPAN&gt;| fieldsAdd entityAttr(dt.entity.host, "tags")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| filter in(id, classicEntitySelector(concat("type(service), tag(\"APP:", $APPLICATION, "\")")))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| filter in(id, classicEntitySelector(concat("type(service), tag(\"ENVIRONMENT:", $ENTORNO, "\")")))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| dedup id&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| fields entity.name, serviceType, entity.customized_name, id, runs_on[dt.entity.host]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and check if you get the desired results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope it helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Elena.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2025 11:13:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/279719#M2222</guid>
      <dc:creator>erh_inetum</dc:creator>
      <dc:date>2025-06-18T11:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: host name in services running on host dlq</title>
      <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/279747#M2224</link>
      <description>&lt;P&gt;I always get an empty field in host.name results, it doesnt work for me&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2025 13:00:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/279747#M2224</guid>
      <dc:creator>Pablo2</dc:creator>
      <dc:date>2025-06-18T13:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: host name in services running on host dlq</title>
      <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/279825#M2225</link>
      <description>&lt;P&gt;You can use the entityName() function in place of the lookup function to get the host names. The other thing to account for is that the runs_on[dt.entity.host] field is an Array field. This means we need to expand the array before we use the entityName function. We can then summarize to form an array of host names. The DQL for this looks as follows:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;fetch dt.entity.service
| expand dt.entity.host=runs_on[dt.entity.host]
| fieldsAdd host_name = entityName(dt.entity.host) // Add the host name
| summarize host_names = collectArray(host_name), by:{id,entity.name} // summarize to create a host_names array
| fieldsAdd entityAttr(dt.entity.host, "tags")
| filter in(id, classicEntitySelector(concat("type(service), tag(\"APP:", $APPLICATION, "\")")))
| filter in(id, classicEntitySelector(concat("type(service), tag(\"ENVIRONMENT:", $ENTORNO, "\")")))
// removed dedup command, as it is no longer needed after using the summarize command above&lt;/LI-CODE&gt;&lt;P&gt;This should work, I hope.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2025 22:07:52 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/279825#M2225</guid>
      <dc:creator>marco_irmer</dc:creator>
      <dc:date>2025-06-19T22:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: host name in services running on host dlq</title>
      <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/280732#M2249</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/19769"&gt;@marco_irmer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your inputs, I've tried the suggested DQL Query but it didn't work, what might be the missing part.&lt;BR /&gt;&lt;BR /&gt;fetch dt.entity.service&lt;BR /&gt;| expand dt.entity.host=runs_on[dt.entity.host]&lt;BR /&gt;| fieldsAdd host_name = entityName(dt.entity.host) // Add the host name&lt;BR /&gt;| summarize host_name = collectArray(host_name), by:{id,entity.name} // summarize to create a host_names array&lt;BR /&gt;| fieldsAdd entityAttr(dt.entity.host, "tags")&lt;BR /&gt;| filter in(id, classicEntitySelector(concat("type(service), tag(\"Env:" , abc", \")")))&lt;BR /&gt;| filter in(id, classicEntitySelector(concat("type(service), tag(\"Env:" , xyz", \")")))&lt;BR /&gt;&lt;BR /&gt;BR,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 14:56:21 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/280732#M2249</guid>
      <dc:creator>Peter_Youssef</dc:creator>
      <dc:date>2025-07-03T14:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: host name in services running on host dlq</title>
      <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/281344#M2294</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/51369"&gt;@Peter_Youssef&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Try adding this:&lt;/P&gt;&lt;P&gt;| fieldsAdd dt.entity.host.name = entityAttr(dt.entity.host, "entity.name")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Charles&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 03:02:38 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/281344#M2294</guid>
      <dc:creator>CharlesPerez</dc:creator>
      <dc:date>2025-07-11T03:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: host name in services running on host dlq</title>
      <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/281569#M2308</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/72255"&gt;@CharlesPerez&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;will try it out.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 11:19:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/281569#M2308</guid>
      <dc:creator>Peter_Youssef</dc:creator>
      <dc:date>2025-07-15T11:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Host name in services running on host dql</title>
      <link>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/281579#M2309</link>
      <description>&lt;P&gt;Just change your last line with the fields command to this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields entity.name, serviceType, entity.customized_name, id, entityName(dt.entity.host)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 15 Jul 2025 14:01:21 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Host-name-in-services-running-on-host-dql/m-p/281579#M2309</guid>
      <dc:creator>StrangerThing</dc:creator>
      <dc:date>2025-07-15T14:01:21Z</dc:date>
    </item>
  </channel>
</rss>

