count_over_time({filename="/var/log/message"} |~ "oom_kill_process" [5m])) 聚合函数 LogQL 也支持聚合运算,我们可用它来聚合单个向量内的元素,从而产生一个具有较少元素的新向量,当前支持的聚合函数如下: sum:求和 min:最小值 max:最大值 avg:平均值 stddev:标准差 stdvar:标准方差 count:计数 bot...
count_over_time: 对指定范围内的每个日志流的条目进行计数 bytes_rate: 计算日志流每秒的字节数 bytes_over_time: 对指定范围内的每个日志流的使用的字节数 比如计算 nginx 的 qps: rate({filename="/var/log/nginx/access.log"}[5m])) 1. 计算kernel 过去 5 分钟发生 oom 的次数: count_over_time({f...
count_over_time:计算给定范围内每个日志流的条目。 //对fluent-bit作业在最近五分钟内的所有日志行进行计数。 count_over_time({job="fluent-bit"}[5m]) #获取fluent-bit作业在过去十秒内所有非超时错误的每秒速率。 1. rate({job="fluent-bit"} |= "error" != "timeout" [10s] #集合运算符 1. 与...
count_over_time(range-vector) 指定时间间隔内范围向量所有元素样本值的计数 day_of_month(v=vector(time()) instant-vector) 返回UTC中每个给定时间的月份。返回值是1到31 day_of_week(v=vector(time()) instant-vector) 返回UTC中每个给定时间的星期几。返回值是从0到6,其中0表示星期日 days_in_month(v...
Describe the bug When trying to count the number of spans using count_over_time the actual count gets doubled randomly. Query used was {} | count_over_time() by (name) To Reproduce Steps to reproduce the behavior: Use https://github.com/...
16、hour(v=vector(time()) instant-vector) 函数返回被给定 UTC 时间的当前第几个小时,时间范围:0~23。 17)、minute(v=vector(time()) instant-vector) 函数返回给定 UTC 时间当前小时的第多少分钟。结果范围:0~59。 18)、month(v=vector(time()) instant-vector) 函数返回给定 UTC 时间当前属于第几个...
count_over_time({filename="/var/log/operation.LOG"} | json [1m])) 上面这条查询语句可以这么理解, 一般Loki查询语句的范式是这样的。 更多的LogQL查询的算子,可以参考官方文档https://grafana.com/docs/loki/latest/logql/ Loki的查询速度 构造了3种日志查询的场景,来看一下Loki在查询侧的表现 ...
count_over_time({job="jm-admin"}[5m]) image-20210926173014782 获取在过去十秒内所有非超时错误的每秒速率 rate({job="jm-admin"} |="error"!="timeout"[10s] 集合运算符 ❝ 与PromQL一样,LogQL支持内置聚合运算符的一个子集,可用于聚合单个向量的元素,从而产生具有更少元素但具有集合值的新向量 ...
sum (count_over_time({job="logstash",alexenv=~"$namespace",podName=~"$serviceName"} |~ "(?i)error"[5m])){alexenv=~"$namespace",podName=~"$serviceName"} (显示实时日志) grafana loki输出格式化:{job="logstash",alexerror="true"} |regexp `(?P<allmsg>(?s)(.+?)$)`|line_...
我们还可以对来自日志的数据进行一些聚合分析。比如这里面汇总过去5分钟内 default 命名空间的 http 状态码,查询语句为:sum(count_over_time({namespace="default"} |= "http.resp.status" | json [5m])) by (http_resp_status) image.png 上面的绿线代表 302 状态码,黄线代表 200 状态码,过去5分钟内没有...