按标签创建字段平均值的条形图?

发布于 2025-01-16 18:59:02 字数 641 浏览 0 评论 0原文

我在服务器上设置了 Promtail,以按主机、端点等标记日志行,并在 Loki 中从这些日志行中提取响应时间作为字段。

以下是来自 Grafana 中的资源管理器的示例日志: 屏幕截图来自 Grafana 中的资源管理器的日志行,扩展为显示标签(端点、端点类型、文件名、主机、promtail_config_version 和 request_type)和检测到的字段(action_time_ms、ts、和 tsNs)

我想要做的是将这些日志转换为条形图,显示端点的平均响应时间 (action_time_ms)。

我在 Loki LogQL 文档中找到了 指标查询页面,但是我不知道如何将其转换为 Grafana 的正确查询类型,以从中制作条形图。领域还重要吗?

Grafana v8.4.2、Loki/Promtail v2.4.2。

I have Promtail set up on my servers to label log lines by host, endpoint, etc. and Loki to extract response times from these log lines as a field.

Here's a sample log from the explorer in Grafana:
Screenshot of a log line from the explorer in Grafana, expanded to show labels (endpoint, endpoint_type, filename, host, promtail_config_version, and request_type) and detected fields (action_time_ms, ts, and tsNs)

What I want to do is turn these logs into a bar chart, showing average response time (action_time_ms) by endpoint.

I've found the metric queries page in the Loki LogQL docs, but I'm not sure how to turn that into the right kind of query for Grafana to make a bar chart out of it. Do fields even matter?

Grafana v8.4.2, Loki/Promtail v2.4.2.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文