I am working on a Loki-based Dashboard on Grafana. I have one panel for searching text in the Loki trace logs, the current query is like:
{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.
I want to include another variable skipTestLog
to skip logs created by some test cron tasks. skipTestLog
is a custom variable of two options: 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
?
Create a key/value custom variable like in the following example:
Use the variable like in the following example: