Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use entitySelector() to query by host in Data Explorer?

Frequent Guest

when I query in Data explorer:

1. I used "builtin:billing.ddu.log.byEntity" query and returned 91 records:



2. then add filter in this query "builtin:billing.ddu.log.byEntity:filter(in("dt.entity.monitored_entity", entitySelector("type(~"HOST~")")))" returned "No data" and no hint of syntax error:



3.  and the details exported using API, all the malricids written are "PROCESS_GROUP_INSTANCE-???":


 May I ask : is it because ddu.log metric cannot express the data by host? or am i using the wrong query? If I can use "entitySelector" in Metric query, I could query many different entities such as : gateway, cloud instances, services, etc. So please help me.


Dynatrace Mentor
Dynatrace Mentor

That is correct, the split of the dimension is done by process group instance, and not by host. Because of this, you can't split by host on this metric, but you can filter by a specific host or set of hosts by using relationships in the entity selector. For example, in your case, it might look something like:

builtin:billing.ddu.log.byEntity:filter(in("dt.entity.monitored_entity", entitySelector(type(PROCESS_GROUP_INSTANCE),fromRelationships.isProcessOf(type(HOST),entityId(<HOST-ID>)))))

Instead of entityId you can then use whatever entity selector filter you want in there for your host, as per the documentation.

DynaMight Leader
DynaMight Leader


What happens if you add ":parents", something as "builtin:billing.ddu.log.byEntity:parents"

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl