# Log query and usage costs

**URL:** <https://community.dynatrace.com/t/log-query-and-usage-costs/51816>\
**Category:** Logs\
**Tags:** dql, logs\
**Created:** [May 26, 2025, 8:22am UTC](https://community.dynatrace.com/t/log-query-and-usage-costs/51816 "2025-05-26T08:22:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichalBojko](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/michalbojko/32/25320_2.png) [@MichalBojko](https://community.dynatrace.com/u/MichalBojko)\
**Post date:** [May 26, 2025, 8:22am UTC](https://community.dynatrace.com/t/log-query-and-usage-costs/51816/1 "2025-05-26T08:22:42Z")

</div>

Hi,

I am getting familiar with OOTS Log Query and Usage Costs dashboard and when changing the timeframe to 2hours I usually get strange results in the “Top 10 queries by volume”. Some of the entries are “null”. What is the reason for this?

I can see that there is a query behind it that pulls billing\_usage\_event.

fetch dt.system.events  
| filter event.kind == “BILLING\_USAGE\_EVENT” and event.type == “Log Management & Analytics - Query” and event.version == “1.0”  
| filter in(“ALL”, $User) OR in(user.email, $User)  
| filter in(“ALL”, $Application) OR in(client.application\_context, $Application)  
| sort billed\_bytes desc  
| limit 10  
| lookup [  
fetch dt.system.query\_executions  
],  
sourceField: query\_id,  
lookupField: query\_id,  
prefix: “executiondata.”,  
executionOrder:leftFirst  
| fields  
timestamp=toTimestamp(executiondata.timestamp),  
query\_string=executiondata.query\_string,  
query\_volume=toDouble(billed\_bytes),  
query\_cost = toDouble(billed\_bytes)/1024/1024/1024\*toDouble($Price),  
User=user.email,  
App=client.application\_context  
| fieldsRename `Query string`=query\_string, `Query volume`=query\_volume, `Query cost`=query\_cost  
| sort `Query volume` desc

I use Demo Live environment.

 ![MichalBojko_0-1748247648765.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/5/25472e35bf42121cf13d10dea7935f3ec36beae7.png)

---

<div class="post-metadata">

**Author:** ![Mohamed\_Hamdy](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Mohamed\_Hamdy](https://community.dynatrace.com/u/Mohamed_Hamdy)\
**Post date:** [May 27, 2025, 5:40am UTC](https://community.dynatrace.com/t/log-query-and-usage-costs/51816/2 "2025-05-27T05:40:41Z")

</div>

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

I’ve checked the same scenario in the demo environment, and it appears that the issue is due to the query\_id not matching between dt.system.events and dt.system.query\_executions.

Best regards,  
Mohamed

---

<div class="post-metadata">

**Author:** ![MichalBojko](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/michalbojko/32/25320_2.png) [@MichalBojko](https://community.dynatrace.com/u/MichalBojko)\
**Post date:** [June 30, 2025, 8:10am UTC](https://community.dynatrace.com/t/log-query-and-usage-costs/51816/3 "2025-06-30T08:10:56Z")

</div>

Thanks ! This help in a way, It is not my local problem.  
What I heard is that two datasets used in the query are not synchronized, meaning one is “refreshed” more frequently than the other. For that reason this situation is “as expected”. Way to overcome is to use 24h timeframe.
