Loki: Get the log volume per hour

  • What Grafana version and what operating system are you using?
    9.0.1

  • What are you trying to achieve?
    I want to create a bar chart that shows me the number of errors in a log per hour, such that I receive 24 bars (if range is set to a day).

  • How are you trying to achieve it?
    My current experiments with logql got me to:

count_over_time({job="syslog", host="$nodename"} |~ `(?i)error` [$__range])
  • What happened?
    The output is continuous and there is a bar for every second (?)

  • What did you expect to happen?

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?
    New in Grafana 8.4: How to use full-range log volume histograms with Grafana Loki | Grafana Labs
    I tried to follow this except the sum_by level as I do not have a “level” label. Instead I’m using the filter function to achieve something similar.