gpt4 book ai didi

grafana查看日志的方法

转载 作者:知者 更新时间:2024-03-13 00:59:14 25 4
gpt4 key购买 nike

单个job查询

{job="default/prometheus"}

常见的实例

{job="monitoring/prometheus"}
{job="monitoring/kube-state-metrics"}
{job="monitoring/promtail"}
{job="traefik/prod-traefik"}
{job="1442448583092736000/grafana"}

组合查询:

{app="cassandra",namespace="prod"}

过滤搜索词的查询

{app="cassandra"} |~ "(duration|latency)s*(=|is|of)s*[d.]+"
{app="cassandra"} |= "exact match"
{app="cassandra"} != "do not match"

支持精确查询和正则表达式的查询

日志管道

{job="mysql"} != "metrics" | logfmt | duration > 10s

此查询针对 MySQL 作业,过滤掉不包含单词“metrics”的日志,并解析每个日志行以提取更多标签和过滤器。

计算时间

count_over_time({job="mysql"}[5m])

此查询计算 MySQL 作业最后五分钟内的所有日志行。

速率

rate(({job="mysql"} |= "error" != "timeout")[10s])

此查询获取 MySQL 作业在最后十秒内所有非超时错误的每秒速率。

聚合,计算,分组

sum(count_over_time({job="mysql"}[5m])) by (level)

获取过去五分钟内的日志计数,按级别分组。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com