# How to trend off log field

**URL:** <https://community.dynatrace.com/t/how-to-trend-off-log-field/54343>\
**Category:** Dashboarding\
**Tags:** timeframe, dashboards\
**Created:** [December 9, 2025, 2:55pm UTC](https://community.dynatrace.com/t/how-to-trend-off-log-field/54343 "2025-12-09T14:55:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vm\_molson](https://avatars.discourse-cdn.com/v4/letter/v/b782af/32.png) [@vm\_molson](https://community.dynatrace.com/u/vm_molson)\
**Post date:** [December 9, 2025, 2:55pm UTC](https://community.dynatrace.com/t/how-to-trend-off-log-field/54343/1 "2025-12-09T14:55:04Z")

</div>

I’m new to DT, so forgive me if this is too simple. What I am trying to do is create a dashboard which shows “operations” across a time period and only shows ones that:

1. Have degraded over the time period I am looking at
2. Have an average response time greater than some value I set (will be a variable)
3. Appear more than X times per .. day?&nbsp; (will be a variable)

The response time is a field in our log entries (totalSecs). I added a dashboard portlet using this DQL:

timeseries avg\_duration = avg(log.totalsecs), by:{operation}  
| filter(arrayAvg(avg\_duration) \> 2)  
| filter(arrayAvg(avg\_duration) \< 3000)

I’m not sure how to do the first or last piece of the puzzle. I also \*think\* the filters I _have_ defined are working, but not sure if this syntax is right.

---

<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:** [December 9, 2025, 4:04pm UTC](https://community.dynatrace.com/t/how-to-trend-off-log-field/54343/2 "2025-12-09T16:04:58Z")

</div>

Hi,  
In my opinion, your current timeseries query correctly filters by average duration, but it can’t detect degradation over time or enforce “X times per day” conditions.

To do that, you need to:

aggregate per day

compare first vs last daily averages for degradation

apply the count per day threshold

This requires a log-based summarize approach, not just a single timeseries.

Try this:

```markup
fetch logs
| filter isNotNull(totalSecs)

| fieldsAdd
    duration = toDouble(totalSecs),
    day = formatTimestamp(timestamp, format:"yyyy-MM-dd")

| summarize
    avg_duration = avg(duration),
    first_seen = min(duration),
    last_seen = max(duration),
    per_day = count(),
    by:{operation, day}

| summarize
    avg_duration = avg(avg_duration),
    total_count = sum(per_day),
    first_seen = min(first_seen),
    last_seen = max(last_seen),
    by:{operation}

| fieldsAdd
    degraded = last_seen > first_seen

| filter degraded == true
| filter avg_duration > 2
| filter total_count > 10

```

This requires a log-based summarize approach, not just a single timeseries.
