[英]Grafana - Is it possible to use variables in Loki-based dashboard query?
I am working on a Loki-based Dashboard on Grafana.我正在 Grafana 上开发基于 Loki 的仪表板。 I have one panel for searching text in the Loki trace logs, the current query is like:我有一个用于在 Loki 跟踪日志中搜索文本的面板,当前查询如下:
{job="abc-service"}
|~ "searchTrace"
|json
|line_format "{if .trace_message}} Message: \t{{.trace_message}} {{end}}"
Where searchTrace
is a variable of type "Text box" for the user to input search text.其中searchTrace
是“文本框”类型的变量,供用户输入搜索文本。
I want to include another variable skipTestLog
to skip logs created by some test cron tasks.我想包含另一个变量skipTestLog
以跳过某些测试 cron 任务创建的日志。 skipTestLog
is a custom variable of two options: Yes,No
. skipTestLog
是两个选项的自定义变量: Yes,No
。
Suppose the logs created by test cron tasks contain the text CronTest
in the field trace_message
after the json
parser, are there any ways to filter them out based on the selected value of skipTestLog
?假设测试 cron 任务创建的日志在json
解析器之后的字段trace_message
中包含文本CronTest
,有没有什么方法可以根据skipTestLog
的选择值过滤掉它们?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.