cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

is it possible to show yesterday or previous data/logs but at the same time duranion should be pick from dashboad timeframe?

Tarunbt
Observer

I want to create tile with day -1 or previous date but at the same time I want to use common dashboard timeframe.

Mean if I set 4 hours in dashboard time duration tile show yesterday's 4 hours data so that I can compare with today's data.

3 REPLIES 3

krzysztof_hoja
Dynatrace Champion
Dynatrace Champion

There are 2 ways to approach it:

Yes, it is possible using special build-in variables: $dt_timeframe_from and $dt_timeframe_to.
Use can use them explicitly in query to specify interesting time range as well as include them in expression which results in different time range as original.

In the query below I am going for timeframe 24h earlier then this specified in dashboard controls:

fetch logs, from:toTimestamp($dt_timeframe_from)-24h, 
to: toTimestamp($dt_timeframe_to)-24h
| summarize m1=min(timestamp), m2=max(timestamp)

Here is how result looks like. Left tile show results of same query without any time modification, so for last 30 minutes. 

krzysztof_hoja_0-1738833808175.png

 

When dealing with timeseries you can also use shift: parameter, to go for time range different then specified, but in relation to it. Query below will contain 2 timeseries: current one and this from previous day, but "mapped" into current time, so results will be synchronized on chart:

timeseries cpu=avg(dt.host.cpu.usage)
| append [
timeseries cpu=avg(dt.host.cpu.usage), shift: -24h
]

 Result looks like this:

krzysztof_hoja_1-1738834431784.png

Please select X-axis->Displayed timeframe->Data to adjust x-axis to basic timeframe.

Could you please share Document page to explore it ?

Tarunbt
Observer

Thanks, It is working as expected. 

Featured Posts