You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loki exporter fails with "parse error: unexpected character inside braces: '.'" when using standard resource attributes (e.g. service.name, host.name, pod.name) as explained in the Loki exporter docs.
The reason being that Loki label names don't support . when the docs suggests to use . in resource attribute names listed in loki.resource.labels and the Loki exporter doesn't do sensible escaping.
Steps to Reproduce
Configure an OTel Collector to export logs to Loki using service.name as a Loki label. Config example:
Send OTel logs to this OpenTelemetry collector, for example using a Java app instrumented with the OTel Java Instrumentation agent. Log message looks like the following in the OTel Collector stdout:
Log message is persisted in Loki with a label using an escaped version of service.name: frontend
Actual Result
Persistence in Loki fail with the following exception message in the OTel Collector stdout. the OTel Collector Loki exporter didn't do any escaping of the unsupported .even though all resource attributes of the OTel Semantic Conventions contain dots (.).
2023-01-09T11:10:20.438+0100 info exporterhelper/queued_retry.go:426 Exporting failed. Will retry the request after interval. {"kind": "exporter", "data_type": "logs", "name": "loki/cloud", "error": "HTTP 400 \"Bad Request\": 1:40: parse error: unexpected character inside braces: '.'", "interval": "3.276474745s"}
Workaround
Create with OTel Collector processors the resource attributes used for Loki escaping the original desired resource attributes:
Thank you Cyrille for reporting this bug!
The PR to fix README examples is created #17591
The proposal to escape labels with dots needs some investigation. To make the user experience better we should either escape labels containing dots on the Loki side (currently Loki doesn't support dots in labels, but it could change) or we should replace dots with underscores in Loki exporter to send labels in format Loki supports (the issue is already created #14113)
Thanks @mar4uk. The docs improvement is great and is good enough for the moment.
You are right that investigation is needed to provide a smoother UX related to . vs _
Component(s)
exporter/loki
What happened?
Description
Loki exporter fails with "parse error: unexpected character inside braces: '.'" when using standard resource attributes (e.g.
service.name
,host.name
,pod.name
) as explained in the Loki exporter docs.The reason being that Loki label names don't support
.
when the docs suggests to use.
in resource attribute names listed inloki.resource.labels
and the Loki exporter doesn't do sensible escaping.Steps to Reproduce
service.name
as a Loki label. Config example:Expected Result
Log message is persisted in Loki with a label using an escaped version of
service.name: frontend
Actual Result
Persistence in Loki fail with the following exception message in the OTel Collector stdout. the OTel Collector Loki exporter didn't do any escaping of the unsupported
.
even though all resource attributes of the OTel Semantic Conventions contain dots (.
).Workaround
Create with OTel Collector processors the resource attributes used for Loki escaping the original desired resource attributes:
Collector version
v0.68.0
Environment information
Environment
OS: MacOS ARM
OpenTelemetry Collector configuration
Log output
Additional context
No response
The text was updated successfully, but these errors were encountered: