New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backslash in Prometheus label value does not work with dashboard variable #24478
Comments
WorkaroundIf anyone lands here via google, I was able to workaround this PAIN by substituting labels:
logfile: '{{gsub .logfile "\\\\" "/"}}' so I dunno if prometheus relabeling is able to do this, the docs there did not look that promising on first sight. |
backslashtest{logfile=~"${logfile}"} Should work as it will use the prometheus specific regex escaping logic. |
Are you able to reproduce? The issue does not appear when using |
Seems like this may be a duplicate of #20869 |
Closed by #26205 |
What happened:
A prometheus label value containing a backlash
\
causes an error when using the value via grafana dashboard variable. Example:logfile="C:\test\logfile.txt"
What you expected to happen:
There should be some way to make it work?
How to reproduce it (as minimally and precisely as possible):
backslashtest{logfile="C:\test\logfile.txt"}
, easiest created by textfile collector.Name
=logfile
,Type
=Query
,Datasource
=Prometheus,Query
=label_values(backslashtest, logfile)
, this gives:or
yields:
I tried all the advanced-variable-format-options, neither worked.
yields
"1:23: parse error: unknown escape sequence U+002E '.'"
The only one that does not throw an error is
backslashtest{logfile="${logfile:percentencode}"}
but Prometheus returns no data for this.Using the regex Operator
=~
makes no difference:Only this works:
backslashtest{logfile="C:\\test\\logfile.txt"}
Is there a way to use the variable?
Anything else we need to know?:
Query-Inspector:
grop_exporter
backslashtest{logfile="C:\\test\\logfile.txt"}
Related?: #10555 #20869
Environment:
v6.7.3 and v7.0.0-beta3 (2169fc1a3f)
2.18.1
Windows 10 1909
Windows 10 1909
, Firefox 75The text was updated successfully, but these errors were encountered: