# Extract the name of the entities impacted or related to the event

**URL:** <https://community.dynatrace.com/t/extract-the-name-of-the-entities-impacted-or-related-to-the-event/43617>\
**Category:** Open Q&A\
**Tags:** dql, events\
**Created:** [January 13, 2024, 5:43pm UTC](https://community.dynatrace.com/t/extract-the-name-of-the-entities-impacted-or-related-to-the-event/43617 "2024-01-13T17:43:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RPbiaggio](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@RPbiaggio](https://community.dynatrace.com/u/RPbiaggio)\
**Post date:** [January 13, 2024, 5:43pm UTC](https://community.dynatrace.com/t/extract-the-name-of-the-entities-impacted-or-related-to-the-event/43617/1 "2024-01-13T17:43:32Z")

</div>

Guys, is it possible to extract the name of the entities impacted or related to the event?

```markup
fetch events, from:now()-6h 
  | filter dt.system.bucket == "default_davis_events" 
  | filter event.kind == "DAVIS_PROBLEM" 
  | summarize {problem = takeMax(record(timestamp, event.id, event.start, event.status, entity_tags,affected_entity_types,affected_entity.id,affected_entity.name) )},
    by:{{display_id,alias:Problem}, {event.start, alias:Inicio},{event.name, alias:Titulo},maintenance.is_under_maintenance, affected_entity.id, affected_entity.name} 
  | fieldsFlatten problem 
  | expand environment = problem.entity_tags 
  | fieldsAdd environment = (environment=="env:PRD")
  | expand entidade.afetada = problem.affected_entity_types 
  | fieldsAdd entidade.afetada = in(entidade.afetada,
      {
        "dt.entity.host", 
        "dt.entity.hypervisor", 
        "dt_entity.cloud_application", 
        "dt.entity.kubernetes_cluster",
        "dt.entity.kubernetes_node",
        "dt.entity.process_group_instance",
        "dt.entity.cloud_application_namespace",
        "dt.entity.custom_device"

      })
  | filter environment == true and maintenance.is_under_maintenance == false
  | filter problem.event.status == "ACTIVE" and entidade.afetada == true

```

When I pass the field, it returns null.

 ![RPbiaggio_1-1705167790460.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/b/db8f6bce7917cdcbea0fb14166cd0aa3ca074875.png)

---

<div class="post-metadata">

**Author:** ![Pawel\_Zalewski](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pawel_zalewski/32/8101_2.png) [@Pawel\_Zalewski](https://community.dynatrace.com/u/Pawel_Zalewski)\
**Post date:** [January 14, 2024, 10:00am UTC](https://community.dynatrace.com/t/extract-the-name-of-the-entities-impacted-or-related-to-the-event/43617/2 "2024-01-14T10:00:30Z")

</div>

Hi,

So I would change

```markup
affected_entity.id

```

to

```markup
affected_entity_ids

```

And about entityName please look on this thread&nbsp;[https://community.dynatrace.com/t5/DQL/Get-Host-Name-in-Open-Events/m-p/230190](https://community.dynatrace.com/post/230190)

Mr.&nbsp;sinisa\_zubic&nbsp;explain there "Since affected\_entity\_ids are stored in an array, we have to expand it and find to every affected entity ID the entity name.&nbsp;&nbsp;"

---

<div class="post-metadata">

**Author:** ![RPbiaggio](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@RPbiaggio](https://community.dynatrace.com/u/RPbiaggio)\
**Post date:** [January 14, 2024, 4:03pm UTC](https://community.dynatrace.com/t/extract-the-name-of-the-entities-impacted-or-related-to-the-event/43617/3 "2024-01-14T16:03:30Z")

</div>

[@Pawel\_Zalewski](https://community.dynatrace.com/user/66060)&nbsp;Thanks for the answer. Should this DQL also work for CUSTOM\_DEVICE? It’s the only one that I can’t extract the name from.

---

<div class="post-metadata">

**Author:** ![Pawel\_Zalewski](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pawel_zalewski/32/8101_2.png) [@Pawel\_Zalewski](https://community.dynatrace.com/u/Pawel_Zalewski)\
**Post date:** [January 14, 2024, 8:36pm UTC](https://community.dynatrace.com/t/extract-the-name-of-the-entities-impacted-or-related-to-the-event/43617/4 "2024-01-14T20:36:33Z")

</div>

I think its depends on what variables your script send to Dynatrace and you need to capture them somehow via DQL but overall it’s shouldn’t. But I’m not really sure about that.
