I'm trying to specify labels when ingesting logs into Loki via the otelcol.exporter.otlphttp exporter component. I want to "relabel" the service.name resource attribute to an attribute app and then add it to the loki.resource.labels or loki.attribute.labels (not sure which one is right here, i tried both). In the steps to reproduce you can see the code. For some reason, the label is not added. This is the output in the livedebugging feature (actual name in Str(...) omitted in the screenshot):
I expected this to work since many other people (and also the docs) do it this way. It's also pretty common in the upstream OTEL Collector, as can be seen here.
I got it working by using another component like this first, but I dont think both should be necessary:
What's wrong?
Hey everybody,
I'm trying to specify labels when ingesting logs into Loki via the
otelcol.exporter.otlphttp
exporter component. I want to "relabel" theservice.name
resource attribute to an attributeapp
and then add it to theloki.resource.labels
orloki.attribute.labels
(not sure which one is right here, i tried both). In the steps to reproduce you can see the code. For some reason, the label is not added. This is the output in the livedebugging feature (actual name in Str(...) omitted in the screenshot):I expected this to work since many other people (and also the docs) do it this way. It's also pretty common in the upstream OTEL Collector, as can be seen here.
I got it working by using another component like this first, but I dont think both should be necessary:
Steps to reproduce
Add this otelcol component configuration to your alloy config.
System information
No response
Software version
Grafana Alloy Helm Chart v0.9.1
Configuration
Logs