# Logs DQL query to fetch user selected current timeframe

**URL:** <https://community.dynatrace.com/t/logs-dql-query-to-fetch-user-selected-current-timeframe/47632>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [September 12, 2024, 5:10pm UTC](https://community.dynatrace.com/t/logs-dql-query-to-fetch-user-selected-current-timeframe/47632 "2024-09-12T17:10:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcnaidu](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@gcnaidu](https://community.dynatrace.com/u/gcnaidu)\
**Post date:** [September 12, 2024, 5:10pm UTC](https://community.dynatrace.com/t/logs-dql-query-to-fetch-user-selected-current-timeframe/47632/1 "2024-09-12T17:10:59Z")

</div>

Query: fetch logs, from:now()-2h

Instead of from:now()-2h,k I would like to pass user selected range (Current timeframe) dynamically and fetch logs accordingly

---

<div class="post-metadata">

**Author:** ![Taylor-Sanchez](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/taylor-sanchez/32/8756_2.png) [@Taylor-Sanchez](https://community.dynatrace.com/u/Taylor-Sanchez)\
**Post date:** [September 13, 2024, 4:05am UTC](https://community.dynatrace.com/t/logs-dql-query-to-fetch-user-selected-current-timeframe/47632/2 "2024-09-13T04:05:40Z")

</div>

Could you clarify your question? What do you mean by user-selected range and the current timeframe? In DQL you can normally specify a specific selected range.

> **[Use DQL queries](https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/dql-guide)**
>
> Find out how DQL works and what are DQL key concepts.

---

<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:** [September 13, 2024, 6:46am UTC](https://community.dynatrace.com/t/logs-dql-query-to-fetch-user-selected-current-timeframe/47632/3 "2024-09-13T06:46:12Z")

</div>

are you after the TimeframeSelector?

[TimeframeSelector | Dynatrace Developer](https://developer.dynatrace.com/design/components-preview/forms/TimeframeSelector/)

Here is some past discussion around this if it helps

[Solved: Using Timeframe Selector as an input for a DQL query - Dynatrace Community](https://community.dynatrace.com/post/206615)
