# Query Daily License Consumption per Host Using DQL

**URL:** <https://community.dynatrace.com/t/query-daily-license-consumption-per-host-using-dql/53932>\
**Category:** DQL\
**Tags:** dql, licensing\
**Created:** [October 29, 2025, 9:37pm UTC](https://community.dynatrace.com/t/query-daily-license-consumption-per-host-using-dql/53932 "2025-10-29T21:37:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NicoleMT](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@NicoleMT](https://community.dynatrace.com/u/NicoleMT)\
**Post date:** [October 29, 2025, 9:37pm UTC](https://community.dynatrace.com/t/query-daily-license-consumption-per-host-using-dql/53932/1 "2025-10-29T21:37:46Z")

</div>

Hello, could you help me with a DQL query to get the daily license consumption of my hosts? I would like the results to be detailed per host. If there is another way to view this information directly in Dynatrace, I would also like to know. Thank you!

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [October 29, 2025, 10:19pm UTC](https://community.dynatrace.com/t/query-daily-license-consumption-per-host-using-dql/53932/2 "2025-10-29T22:19:20Z")

</div>

[@NicoleMT](https://community.dynatrace.com/user/85361)&nbsp;Take a look at the Cost Allocation dashboard below, it has some views that might help you.&nbsp; “Host usage and cost summary” view is what relates to your query

[https://community.dynatrace.com/t5/DPS-Cost-Allocation/DPS-Cost-Allocation-Dashboard-V1-2/m-p/260595](https://community.dynatrace.com/post/260595)

> **[Set up Cost Allocation](https://docs.dynatrace.com/docs/manage-your-costs/allocate/plan-and-set-up)**
>
> Choose an allocation model, register cost centers and products, apply tags via OneAgent, Kubernetes, or telemetry enrichment, and follow naming and shared-cost best practices.

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [October 30, 2025, 10:11am UTC](https://community.dynatrace.com/t/query-daily-license-consumption-per-host-using-dql/53932/3 "2025-10-30T10:11:32Z")

</div>

Hi,  
you can try this:

```markup
fetch dt.system.events, scanLimitGBytes: -1
| filter event.kind == "BILLING_USAGE_EVENT"
| filter event.type == "Full-Stack Monitoring"
| filter isNotNull(dt.entity.host)
| dedup event.id
| summarize fs_gibih = sum(billed_gibibyte_hours),
    by: { day = bin(timestamp, 1d), hostId = dt.entity.host }
| lookup [fetch dt.entity.host],
    sourceField: hostId, lookupField: id

```

And this (not tested, i don’t have enviroment to test it)

```markup
fetch dt.system.events, scanLimitGBytes: -1
| filter event.kind == "BILLING_USAGE_EVENT"
| filter event.type == "Infrastructure Monitoring"
| filter isNotNull(dt.entity.host)
| dedup event.id
| summarize infra_hosth = sum(billed_host_hours),
    by: { day = bin(timestamp, 1d), hostId = dt.entity.host }
| lookup [fetch dt.entity.host],
    sourceField: hostId, lookupField: id

```

**fetch dt.system.events, scanLimitGBytes: -1**  
Fetches system events from storage (with no scan limit in this query).

**| filter event.kind == “BILLING\_USAGE\_EVENT”**  
Keeps only billing-related events.

**| filter event.type == “Full-Stack Monitoring”**  
Narrows to the “Full-Stack Monitoring” billing type (where fields like billed\_gibibyte\_hours are present).

**| filter isNotNull(dt.entity.host)**  
Keeps only events that are linked to a specific host (i.e., have dt.entity.host).

**| dedup event.id**  
Removes any duplicate events using the unique event.id.

**| summarize fs\_gibih = sum(billed\_gibibyte\_hours), by: { day = bin(timestamp, 1d), hostId = dt.entity.host }**  
Aggregates data so you get one row per (day, host):

- day — timestamp bucketed to 1 day (bin(…, 1d)),
- hostId — the host entity ID (e.g., HOST-…),
- fs\_gibih — the sum of billed\_gibibyte\_hours for that host on that day.
