07 Oct 2025 09:05 AM
I have the following DQL to retrieve entities related to a host, but I need to know the entity name and not the IDs. Is there any way to obtain them?
fetch dt.entity.host
| filter entity.name == ‘DAMA2021.ppcloudmgmt.intraxa’
| fieldsAdd calls, called_by, instance_of, contains, runs, belongs_to
07 Oct 2025 10:12 AM
Hi @Pablo2 ,
fetch dt.entity.host
| fieldsFlatten calls
| expand callId = calls.dt.entity.host
| lookup sourceField: callId, lookupField: id,
[ fetch dt.entity.host | fields id, entity.name ]
| summarize callNames = collectDistinct(lookup.entity.name), by:{id, entity.name }
| sort entity.name
I suppose you need something like this? It is only for calls, but can be extended for the other fields.
Regards, Deni
08 Oct 2025 12:03 PM
Hi @Pablo2
@deni is right. Here are a few additional variants you can use depending on your needs:
Just the raw call IDs (split into rows):
fetch dt.entity.host
| filter entity.name == "easytravel-demo1"
| fieldsKeep id, entity.name, calls
| fieldsFlatten calls
| expand callId = calls.dt.entity.host
| fieldsKeep entity.name, callId2. IDs + resolved entity names (with lookup):
fetch dt.entity.host
| filter entity.name == "easytravel-demo1"
| fieldsKeep id, entity.name, calls
| fieldsFlatten calls
| expand callId = calls.dt.entity.host
| lookup sourceField: callId, lookupField: id,
[ fetch dt.entity.host | fields id, entity.name ]
| summarize callNames = collectDistinct(lookup.entity.name), by:{ id, entity.name }3. Filtered by prefix/substring in the name:
fetch dt.entity.host
| filter entity.name == "easytravel-demo1"
| fieldsKeep id, entity.name, calls
| fieldsFlatten calls
| expand callId = calls.dt.entity.host
| lookup sourceField: callId, lookupField: id,
[ fetch dt.entity.host | fields id, entity.name ]
| filter startsWith(lower(lookup.entity.name), "aks-")
| filter contains(lower(lookup.entity.name), "dynatrace.org")
| summarize callNames = collectDistinct(lookup.entity.name), by:{ id, entity.name }4. One row per call (no aggregation, raw list):
fetch dt.entity.host
| filter entity.name == "easytravel-demo1"
| fieldsKeep id, entity.name, calls
| fieldsFlatten calls
| expand callId = calls.dt.entity.host
| filter isNull(callId) == false and callId != id
| lookup sourceField: callId, lookupField: id,
[ fetch dt.entity.host | fields id, entity.name ]
| filter isNull(lookup.entity.name) == false
| fieldsKeep entity.name, callId, lookup.entity.name
| sort lookup.entity.name