英文:
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.+"}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论