惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
U
Unit 42
MyScale Blog
MyScale Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
量子位
IT之家
IT之家
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Recent Announcements
Recent Announcements
V
Visual Studio Blog
G
Google Developers Blog
Last Week in AI
Last Week in AI
雷峰网
雷峰网
博客园 - 聂微东
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
博客园 - 司徒正美
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏

Grafana

大家的 Grafana+Prometheus 都接了什么告警系统? 如何修改下拉框筛选的选项变成中文进行显示? Grafana 如何根据已经有的 Panel 里的 Threshold 来自动的生成对应的 Alert Rule? Grafana OnCall 只能在 Grafana Could 上用吗? 「Grafana Plugin」支持 jsx 实时渲染的 grafana 面板插件 才部署几天的 loki 产生的小文件既然有 234.5W 求助一个 Grafana 展示网络线路状态问题,有偿 怎么在 Panel 里同时展示 value 和 tag 呢? 最近我安装了 Loki + Promtail + Grafana,感觉这一组合可以取代 Elasticsearch + Logstash 大佬们,这条 promql 怎么写哇 用人用过 grafana Synthetic-monitoring 吗 grafana 可以做离线非实时数据的在线展示吗? 使用 docker 制作了一个简单的 grafana 监控工具 Grafana - An open source, feature rich metrics dashboard and graph editor for Graphite, InfluxDB & OpenTSDB.
为什么在 Loki 中要在使用 sum_over_time()后使用 sum()?
dadagogogo · 2024-05-22 · via Grafana

我采集了 Nginx 的一些日志到 Loki 中,想在 Grafana 中展示,日志关键内容如下

{"bytes_sent": 1400, "uri":"/test"}
{"bytes_sent": 1300, "uri":"/test"}

我尝试使用下述 LogQL 。

sum_over_time({job="$job"} | json |  unwrap bytes_sent  [$__interval])

对应的 Query Inspector 是

Expr: sum_over_time({job="nginx_access_log"} | json |  unwrap bytes_sent  [1m])
Step: 1m0s

但我得到了这样的图:

grafana graph

在这个图中,每个点的 legend 是整个日志,内容是 bytes_send 的值,为什么 sum_over_time 返回的是这些内容呢?

当我尝试在其之前加多一个 sum()时,我得到了我想要的内容和图。

sum(sum_over_time({job="$job"} | json |  unwrap bytes_sent  [$__interval]))

right graph

我实在不知道为什么要在 sum_over_time 前要加 sum 方法,而不是只用 sum_over_time 就可以了。