# A simple DQL to do a search for an IP to host in Dynatrace.

**URL:** <https://community.dynatrace.com/t/a-simple-dql-to-do-a-search-for-an-ip-to-host-in-dynatrace/42636>\
**Category:** DQL\
**Tags:** dql\
**Created:** [November 15, 2023, 4:28pm UTC](https://community.dynatrace.com/t/a-simple-dql-to-do-a-search-for-an-ip-to-host-in-dynatrace/42636 "2023-11-15T16:28:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [November 15, 2023, 4:28pm UTC](https://community.dynatrace.com/t/a-simple-dql-to-do-a-search-for-an-ip-to-host-in-dynatrace/42636/1 "2023-11-15T16:28:00Z")

</div>

I appreciate a simple DQL to search for a host name given an IP. How simple could it be?

---

<div class="post-metadata">

**Author:** ![mizso74](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mizso74/32/41729_2.png) [@mizso74](https://community.dynatrace.com/u/mizso74)\
**Post date:** [November 15, 2023, 6:59pm UTC](https://community.dynatrace.com/t/a-simple-dql-to-do-a-search-for-an-ip-to-host-in-dynatrace/42636/2 "2023-11-15T18:59:42Z")

</div>

Hi&nbsp;[@MarwanC](https://community.dynatrace.com/user/64346),

I hope I understand your request well. To be honest I am not a DQL guru I have just started to learn.

I would create a dashboard with this DQL (you can add other extra fields if you want).

fetch dt.entity.host  
| fieldsAdd ipAddress, entity.detected\_name  
**| filter in (ipAddress, array($IP) )**

In order to work well I created a variable = IP

Variable DQL:

fetch dt.entity.host  
| fieldsAdd ipAddress  
| fieldsRemove entity.name, id

 ![Mizs_3-1700074964582.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/2/42e48ffcf4e5ab79b8a30eb15085bcc8b2b0739c.png)

This is the results, you can search hosts by IP address:

 ![Mizs_0-1700074310580.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/c/ecf29dd5069afdca49baff37d59d29eb74ccc78c.png)

 ![Mizs_1-1700074445585.png](https://global.discourse-cdn.com/dynatrace/original/2X/7/7c70d7ffdcc26175a25282eb6f18dc165abc2d89.png)

I hope it helps.

Best regards,

Mizső

---

<div class="post-metadata">

**Author:** ![radek\_jasinski](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radek_jasinski/32/10432_2.png) [@radek\_jasinski](https://community.dynatrace.com/u/radek_jasinski)\
**Post date:** [November 16, 2023, 12:22pm UTC](https://community.dynatrace.com/t/a-simple-dql-to-do-a-search-for-an-ip-to-host-in-dynatrace/42636/3 "2023-11-16T12:22:14Z")

</div>

A very comprehensive answer&nbsp;😊
