Skip to content
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

Extract values from labels in loki.relabel #2842

Open
setpill opened this issue Feb 26, 2025 · 0 comments
Open

Extract values from labels in loki.relabel #2842

setpill opened this issue Feb 26, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@setpill
Copy link

setpill commented Feb 26, 2025

Request

A new action for loki.relabel:

  • labelextract - Matches regex against all label names. Any labels that match are added to the extracted values map, renamed according to the contents of the replacement 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.

@setpill setpill added the enhancement New feature or request label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant