I’m sending error logs to Loki via Promtail and wish to visualize them in Grafana. Specifically, I want to display in a pie chart how many systems are online and offline. The query that should correspond to this is: (sum(count by(system) (count_over_time({job="mrs_error_list"} |=
Timestamp [1m]))))
. All systems that have created a ‘Timestamp’ entry in the last minute are considered offline.
Additionally, I want to display the number of systems offline in the pie chart. This number should be the difference between systems that have created an entry in the last hour and systems that have created an entry only in the last minute. The query for this is: (sum(count by(system) (count_over_time({job="mrs_error_list"} |=
Timestamp[1h])))) - (sum(count by(system) (count_over_time({job="mrs_error_list"} |=
Timestamp [1m]))))
.
The issue I’m facing is that when I adjust the time from the dashboard itself (for example, to the last hour), it automatically applies to the first query. This isn’t what I want since I need a fixed value of 1m for that query. Is this the intended behavior or am I using the wrong functions to implement the desired feature?