-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Loki fails to create labels containing the symbol \uf04a #3038
Comments
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Can something be done here? @cyriltovena |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
The same problem is if message contains "\x00" Minimal message inserted into Loki with this error: {"message":"some string\u0000"} |
@dannykopping is looking into this. |
@patrickhuy this looks like a bug in the Prometheus parser which we use to parse our labels; I'll hopefully find a fix for this soon and submit it for review. I've managed to isolate this issue in a failing test against In the meantime, a workaround for you could be to use a new feature merged in recently (#3280) which allows for the selective extraction of labels using the JSON pipeline; you could extract only the labels you care about, provided one of them does not contain this quoted UTF8 value. The problem, as far as I can tell, relates to this code: func (ls Labels) String() string {
var b bytes.Buffer
b.WriteByte('{')
for i, l := range ls {
if i > 0 {
b.WriteByte(',')
b.WriteByte(' ')
}
b.WriteString(l.Name)
b.WriteByte('=')
b.WriteString(strconv.Quote(l.Value)) // <----- this
}
b.WriteByte('}')
return b.String()
} When your |
@patrickhuy this has been merged in Prometheus, but it may take a few days for the changes to be pulled into Loki due to some conflicts in other dependencies. |
Should be fixed now. We've revendored Prometheus after the upstream change 🎉 |
Describe the bug
When a log message contains the symbol "\uf04a" and loki attempts to create a label containing that symbol the operation fails
To Reproduce
Steps to reproduce the behavior:
{ "msg": "lala " }
into loki (using Promtail){app="mytestapp"} |= "lala" | json
parse error: error unquoting string \\\"\\\\\\\"lala \\\\\\\\uf04a\\\\\\\", namespace=\\\\\\\"\\\": invalid syntax\\n\"
in the loki logs.Expected behavior
The label
msg
should be created and have the valuelala
Environment:
Screenshots, Promtail config, or terminal output
Loki logs contain the message
The text was updated successfully, but these errors were encountered: