# Recording rule problem with count\_over\_time 1m and sum by \[1h:1m\]

**URL:** <https://community.grafana.com/t/recording-rule-problem-with-count-over-time-1m-and-sum-by-1h-1m/110731>\
**Category:** Grafana Loki\
**Tags:** loki\
**Created:** [December 25, 2023, 12:57pm UTC](https://community.grafana.com/t/recording-rule-problem-with-count-over-time-1m-and-sum-by-1h-1m/110731 "2023-12-25T12:57:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuburoman](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kuburoman](https://community.grafana.com/u/kuburoman)\
**Post date:** [December 25, 2023, 12:57pm UTC](https://community.grafana.com/t/recording-rule-problem-with-count-over-time-1m-and-sum-by-1h-1m/110731/1 "2023-12-25T12:57:27Z")

</div>

Hi,  
we are trying to count number of logs per minute:

```auto
groups:
  - name: ozeki
    interval: 1m
    rules:
      - record: gate:sms:count1m
        expr: |
          sum(count_over_time({app="Ozeki"}[1m]))

```

And then count number of request per day:

```auto
sum_over_time(gate:sms:count1m[1d:1m])

```

But this result is different from doing request on loki:

```auto
sum(count_over_time({app="Ozeki"}[1d]))

```

It is because recording rule on Loki is every time starting at different time by few seconds, so some records are counted twice and some are not counted at all.

Is it possible to update recording rule so it starts XX:00 and ends atd XX:59? Or is there any other solutions?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [December 24, 2024, 12:58pm UTC](https://community.grafana.com/t/recording-rule-problem-with-count-over-time-1m-and-sum-by-1h-1m/110731/2 "2024-12-24T12:58:24Z")

</div>

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
