# Metrics to fetch services specific to a host tag in Dynatrace Managed

**URL:** <https://community.dynatrace.com/t/metrics-to-fetch-services-specific-to-a-host-tag-in-dynatrace-managed/49581>\
**Category:** Dynatrace Managed\
**Tags:** dynatrace-managed, tagging\
**Created:** [January 6, 2025, 3:35pm UTC](https://community.dynatrace.com/t/metrics-to-fetch-services-specific-to-a-host-tag-in-dynatrace-managed/49581 "2025-01-06T15:35:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ushaghosh](https://avatars.discourse-cdn.com/v4/letter/u/e47c2d/32.png) [@ushaghosh](https://community.dynatrace.com/u/ushaghosh)\
**Post date:** [January 6, 2025, 3:35pm UTC](https://community.dynatrace.com/t/metrics-to-fetch-services-specific-to-a-host-tag-in-dynatrace-managed/49581/1 "2025-01-06T15:35:55Z")

</div>

I would like to filter out all&nbsp; 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.

---

<div class="post-metadata">

**Author:** ![StrangerThing](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/strangerthing/32/12182_2.png) [@StrangerThing](https://community.dynatrace.com/u/StrangerThing)\
**Post date:** [January 6, 2025, 5:49pm UTC](https://community.dynatrace.com/t/metrics-to-fetch-services-specific-to-a-host-tag-in-dynatrace-managed/49581/2 "2025-01-06T17:49:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ushaghosh](https://avatars.discourse-cdn.com/v4/letter/u/e47c2d/32.png) [@ushaghosh](https://community.dynatrace.com/u/ushaghosh)\
**Post date:** [February 10, 2025, 12:31pm UTC](https://community.dynatrace.com/t/metrics-to-fetch-services-specific-to-a-host-tag-in-dynatrace-managed/49581/3 "2025-02-10T12:31:05Z")

</div>

I do not see this option in my managed deployment. For me it starts with&nbsp;builtin:

---

<div class="post-metadata">

**Author:** ![MaciejNeumann](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MaciejNeumann](https://community.dynatrace.com/u/MaciejNeumann)\
**Post date:** [May 15, 2025, 9:33am UTC](https://community.dynatrace.com/t/metrics-to-fetch-services-specific-to-a-host-tag-in-dynatrace-managed/49581/4 "2025-05-15T09:33:08Z")

</div>

Hello&nbsp;[@ushaghosh](https://community.dynatrace.com/user/84580),  
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.

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [May 17, 2025, 10:14am UTC](https://community.dynatrace.com/t/metrics-to-fetch-services-specific-to-a-host-tag-in-dynatrace-managed/49581/5 "2025-05-17T10:14:32Z")

</div>

you will need an entity selector like this one

```markup
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:

```markup
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)

```
