# 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:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![imrj99](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/imrj99/32/21367_2.png) [@imrj99](https://community.dynatrace.com/u/imrj99)\
**Post date:** [July 31, 2025, 1:55pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747/1 "2025-07-31T13:55:24Z")

</div>

which DQL query lets you retrieve all discovered log sources (ingested or not) for a given host group?

I am able to see these log sources in logsourcestate under&nbsp;dt.entity.process\_group\_instance, but not able to filter them, it always comes up null…

---

<div class="post-metadata">

**Author:** ![angelalanis](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@angelalanis](https://community.dynatrace.com/u/angelalanis)\
**Post date:** [August 1, 2025, 5:22pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747/2 "2025-08-01T17:22:00Z")

</div>

Hi, does this query help you?  
You can filter by host group name and you get a list of the unique log sources.

```markup
fetch logs, scanLimitGBytes:10
| fieldsAdd entityName(dt.entity.host)
| fieldsAdd entityName(dt.entity.host_group)
| filter matchesValue(dt.entity.host_group.name, "<HOST-GROUP-NAME>")
| summarize uniqueSources = collectDistinct(log.source)
| expand uniqueSources
| filterOut isNull(uniqueSources)

```

---

<div class="post-metadata">

**Author:** ![imrj99](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/imrj99/32/21367_2.png) [@imrj99](https://community.dynatrace.com/u/imrj99)\
**Post date:** [August 1, 2025, 5:53pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747/3 "2025-08-01T17:53:13Z")

</div>

unfortunately no…it only retrieves those that there is log data for (ie. already being ingested), but not for all detected log sources, even if not ingested..

using the query below I can find all the detected log sources in “dt.entity.process\_group\_instance” under “logSourceState”, but they each come back as columns, which makes it very hard to filter, not sure why this is

_fetch dt.entity.process\_group\_instance, from:now() - 5m_  
_| fieldsAdd logSourceState = logSourceState_  
_| filter isNotNull(logSourceState)_  
_| limit 200_

---

<div class="post-metadata">

**Author:** ![angelalanis](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@angelalanis](https://community.dynatrace.com/u/angelalanis)\
**Post date:** [August 1, 2025, 6:42pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747/4 "2025-08-01T18:42:22Z")

</div>

I see what you mean with coming back as columns, I found this workaround, hopefully it helps you.

```markup
fetch dt.entity.host
| fields id, logSourceState, hostGroupName
| filter matchesValue(hostGroupName, "extensions")
| 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 '\"'"
| fields id, file, state

```

---

<div class="post-metadata">

**Author:** ![imrj99](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/imrj99/32/21367_2.png) [@imrj99](https://community.dynatrace.com/u/imrj99)\
**Post date:** [August 1, 2025, 7:28pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747/5 "2025-08-01T19:28:00Z")

</div>

it didnt, got no results… but i think I see where you are going,&nbsp; I changed the 1st line&nbsp; to dt.entity.proceess\_group\_instance and commented out lines 2,3 and I do get all the log sources in a row format!

I guess from this I need to filter for specific hosts by joining which process group instance runs in which host group?&nbsp; so close!

_fetch dt.entity.process\_group\_instance_  
_//| fields id, logSourceState, hostGroupName_  
_//| filter matchesValue(hostGroupName, “HOSTGROUPNAME”)_  
_| 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 ‘\"’"_  
_| fields id, file, state_

---

<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

```

---

<div class="post-metadata">

**Author:** ![imrj99](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/imrj99/32/21367_2.png) [@imrj99](https://community.dynatrace.com/u/imrj99)\
**Post date:** [August 1, 2025, 10:00pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747/7 "2025-08-01T22:00:38Z")

</div>

awesome!&nbsp; i just need to be able to filter on a specific host group now, i think i could figure that out (maybe!!) lol

---

<div class="post-metadata">

**Author:** ![marusla](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marusla/32/24217_2.png) [@marusla](https://community.dynatrace.com/u/marusla)\
**Post date:** [September 3, 2025, 5:36pm UTC](https://community.dynatrace.com/t/retrieve-detected-log-sources-given-a-host-group/52747/8 "2025-09-03T17:36:19Z")

</div>

Hello, i have the same message no log for process instance, i try the dql but still is empty, which option i have to enable for see process instance logs, thank you
