在LogQL(Grafana)中筛选从多个子文件夹中提取的文件名。

huangapple go评论58阅读模式
英文:

filter filenames in logql (grafana), extracted from multiple subfolders

问题

I am building a dashboard in grafana, and previously, my queries to get the logs were:

{filename=~"/var/logs/tfc/local/reportserver+.+"}

This was to get all rotated files from the reportserver logs.
Now there may be other servers sending their logs into /var/logs/tfc/ but in different subfolders. So I tried this new filter, to get all reportserver logs from all subdirectories:

{filename=~"/var/logs/tfc/**/reportserver+.+"}
But this is not working. How can I modi fy the query to get the result I want?

英文:

I am building a dashboard in grafana, and previously, my queries to get the logs were:

{filename=~"/var/logs/tfc/local/reportserver+.+"}

This was to get all rotated files from the reportserver logs.
Now there may be other servers sending their logs into /var/logs/tfc/ but in different subfolders. So I tried this new filter, to get all reportserver logs from all subdirectories:

{filename=~"/var/logs/tfc/**/reportserver+.+"}
But this is not working. How can I modi fy the query to get the result I want?

答案1

得分: 0

Regex选择器=~使用正则表达式,但您的正则表达式与ant样式的通配符混合在一起。

根据您的描述,我认为您需要以下查询:

{filename=~"/var/logs/tfc/.+/reportserver.+"}
英文:

Regex selector =~ uses regexes, but you have some strange mix of regex and ant-style globs.

Based on your description I believe you need this query:

{filename=~"/var/logs/tfc/.+/reportserver.+"}

huangapple
  • 本文由 发表于 2023年5月18日 02:58:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76275396.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定