# retrieve detected log sources given a host group

**URL:** <https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [July 31, 2025, 1:55pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747 "2025-07-31T13:55:24Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![TracingMySanity](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@TracingMySanity](https://community.dynatrace.com/u/TracingMySanity)\
**Post date:** [August 1, 2025, 9:14pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747/6 "2025-08-01T21:14:59Z")

</div>

Modified your query a bit to get the hostGroup entity attribute using the `belongs_to` relationship from the process\_group\_instance

```markup
fetch dt.entity.process_group_instance
| filterOut isNull(logSourceState)
| fieldsAdd sLogSourceState = toString(logSourceState)
| fieldsAdd sLogSourceState = substring(sLogSourceState, from:1, to: stringLength(sLogSourceState)-1)
| fieldsAdd sLogSourceState = splitString(sLogSourceState,",")
| expand sLogSourceState
| fieldsAdd sLogSourceState=trim(sLogSourceState)
| parse sLogSourceState, "'\"' LD:file '\":\"storageStatus:' LD:state '\"'"
| fieldsAdd host=belongs_to[dt.entity.host]
| fieldsAdd hostGroup=entityAttr(host, type:"dt.entity.host", "hostGroupName")
| fields id, file, state, hostGroup

```

---

_[View the full topic](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747)._
