06 Jan 2025
03:35 PM
- last edited on
15 May 2025
10:33 AM
by
MaciejNeumann
I would like to filter out all the services based on a host tag, what query would help me fetch that info.
Fetch problems based on host tag.
My managemnet zone has 9 environmnets. I would like to segregate them based on a host tag that I defined on the host.
06 Jan 2025 05:49 PM
You can do something like this to get a list of services where the hosts that run them have a certain tag.
fetch dt.entity.service
| expand dt.entity.host=runs_on[dt.entity.host]
| fieldsAdd entityAttr(dt.entity.host, "tags")
| filter matchesPhrase(dt.entity.host.tags, "App:apptag")
| dedup id
| fields entity.name, id
10 Feb 2025 12:31 PM
I do not see this option in my managed deployment. For me it starts with builtin:
15 May 2025 10:33 AM
Hello @ushaghosh,
Dynatrace Managed doesn't use DQL, as the Grail technology is available for customers using Dynatrace SaaS. I'll move your question to the Managed forum, as maybe someone there will be able to help solve your use case.
17 May 2025 11:14 AM
you will need an entity selector like this one
type("SERVICE"),fromRelationships.runsOnHost(type(HOST),tag("[Azure]tenant:CustomerA"))
(you can try it out on the monitored entities api endpoint)
Or you can directly use it on a metric line:
builtin:service.response.client
:filter(
in("dt.entity.service",entitySelector(
"type(SERVICE),fromRelationships.runsOnHost(type(HOST),tag(~"[Azure]tenant:CustomerA~"))"
))
)
:splitBy("dt.entity.service"):sort(value(auto,descending)):limit(20)