# Looking for suggestions related to DQL

**URL:** <https://community.dynatrace.com/t/looking-for-suggestions-related-to-dql/45664>\
**Category:** DQL\
**Tags:** dql, notebooks, logs\
**Created:** [May 19, 2024, 3:20pm UTC](https://community.dynatrace.com/t/looking-for-suggestions-related-to-dql/45664 "2024-05-19T15:20:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry22](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@harry22](https://community.dynatrace.com/u/harry22)\
**Post date:** [May 19, 2024, 3:20pm UTC](https://community.dynatrace.com/t/looking-for-suggestions-related-to-dql/45664/1 "2024-05-19T15:20:49Z")

</div>

Hi All,

I am looking for a way to find below details using DQL. Please suggest:

1. How to get the management zones of the open problems? I tried below but it did not work:

```auto
fetch events | filter event.kind == "DAVIS_PROBLEM" AND matchesValue(labels.management_zone, "NAME_HERE")

```

2. How to know what are the possible fields in a category(logs, events etc) and vice versa(eg.&nbsp;labels.alerting\_profile will be under events?)

3. In&nbsp;labels.alerting\_profile we have multiple elements stored inside it. How to get only those rows in result where&nbsp;labels.alerting\_profile contains only the specified element and nothing else. I tried matchesValue, MatchesPhrase, matchesValue[element] etc however no luck.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![FranciscoGarcia](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/franciscogarcia/32/38292_2.png) [@FranciscoGarcia](https://community.dynatrace.com/u/FranciscoGarcia)\
**Post date:** [May 20, 2024, 11:35am UTC](https://community.dynatrace.com/t/looking-for-suggestions-related-to-dql/45664/2 "2024-05-20T11:35:38Z")

</div>

Hi Harry. 3rd gen dashboards and DQL are not really meant to use management zones so it’s a little more complicated than it should for now. In the future there will be better features (filters) for doing this…

In the meantimen the only way you can access the management zone is to do a lookup with the affected entities. Imagine you want to get services in the “Cloud: Google” MZ. Something like this might help:

```markup
fetch events
| filter event.kind=="DAVIS_PROBLEM"
| dedup display_id, sort:{timestamp desc} // Remove duplicates
| filter contains(tostring(affected_entity_types), "dt.entity.service") 
| expand affected_entity_ids
| filter contains(affected_entity_ids, "SERVICE")
| lookup [fetch dt.entity.service], sourceField:affected_entity_ids, lookupField:id, fields:{managementZones}
| filter contains(toString(managementZones), "Cloud: Google")

```

There are other options, you might want to use the alerting profile, the entity\_tags field, etc…

2 - I feel autocomplete is your best bet. You can also do “fetch events” in a record list visualizations and look at the left part of the table (it has a list of all fields).

 ![FranciscoGarcia_0-1716204410655.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/d/1df829a633a8f1e190261bb1b2b6d6d72baac597.png)

3- Probably becasue labels.alerting\_profile is an array (you can see this in the raw visualization) and those are string functions. You can use tostring to turn it into a string.

```markup
fetch events
| filter contains(toString(labels.alerting_profile), "Default")

```

or use something like arrayIndexOf

---

<div class="post-metadata">

**Author:** ![harry22](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@harry22](https://community.dynatrace.com/u/harry22)\
**Post date:** [May 21, 2024, 5:08pm UTC](https://community.dynatrace.com/t/looking-for-suggestions-related-to-dql/45664/3 "2024-05-21T17:08:33Z")

</div>

Hi Francisco,

Thank you for the details. It is helpful.

Regarding point 2 - How can we do vice versa? Eg. How would someone know that managementZone is under dt.events.service ? Is there a plan/possibility to extend a feature like describe to give more details about a field/category?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![FranciscoGarcia](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/franciscogarcia/32/38292_2.png) [@FranciscoGarcia](https://community.dynatrace.com/u/FranciscoGarcia)\
**Post date:** [May 21, 2024, 8:30pm UTC](https://community.dynatrace.com/t/looking-for-suggestions-related-to-dql/45664/4 "2024-05-21T20:30:40Z")

</div>

Mmmm…I don’t think so. Not sure if it being planned…

There is a semantic dictionary where you might be able to search, but I realize it isn’t exactly what you are asking for:&nbsp;[https://docs.dynatrace.com/docs/platform/semantic-dictionary/model/dt-entities](https://docs.dynatrace.com/docs/platform/semantic-dictionary/model/dt-entities)

Also, in the future I wonder if Davis Copilot might be able to help when it creates DQL queries from natural language…

---

<div class="post-metadata">

**Author:** ![harry22](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@harry22](https://community.dynatrace.com/u/harry22)\
**Post date:** [May 21, 2024, 8:55pm UTC](https://community.dynatrace.com/t/looking-for-suggestions-related-to-dql/45664/5 "2024-05-21T20:55:00Z")

</div>

Thank you, Francisco.

Framing a DQL would be really quick once we have access to create it using Davis Copilot.
