Open
Description
Request
A new action
for loki.relabel
:
labelextract
- Matchesregex
against all label names. Any labels that match are added to the extracted values map, renamed according to the contents of thereplacement
field.
Use case
Many loki.source.*
components provide valuable metadata in internal (__.+
) labels. This metadata is sometimes useful as labels, but more often, it's not. It can be suitable for structured metadata or injecting into the log message itself, but doing so is currently seemingly impossible (there are no loki.process
stages that extract values from labels, and the stages that affect structured metadata or log message do not read from labels). Even if it would be possible to read from labels in these components, you would have to ensure you drop the labels again before sending the log entry to a loki backend.