Open nferch opened 3 months ago
This issue has not had any activity in the past 30 days, so the needs-attention
label has been added to it.
If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue.
The needs-attention
label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!
Request
in
loki.process
,structured_metadata
should optionally flatten a nested value, using the keys of the nested value as metadata keys.For example:
An inbound message structured like this:
Using configuration like this:
Should produce output like this:
Alternatively, if there was a different value to set the
loki.format
hint to that would use the body as the log payload and set other specified keys as metadata, that would work as well.Use case
I am using the
otelcol.receiver
to forward logs to Loki usingotelcol.exporter.loki
. I am using theloki.resource.labels
hint to set certain resource attributes as Loki labels. I would like to set resource and log attributes as Loki log metadata.Out of the box, with the default
json
setting ofjson
theotelcol.exporter.loki
will pass the Otel Log as something like the following, which is not really well suited for my purposes:I can set the
otelcol.exporter.loki
hint toraw
, which will send the body as the log payload, which is closer to what I want, but I lose the resource and log attributes in the process.What is the closest to idea is the following:
This sets the log and resource attributes as values to metadata values, which is better than nothing, but I'm not aware of a way in LogQL to parse metadata fields as JSON.