grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
24.04k stars 3.47k forks source link

loki.process - stage.match selector only supports "labels" - should support "structured_metadata", too #15092

Open Nachtfalkeaw opened 5 days ago

Nachtfalkeaw commented 5 days ago

Is your feature request related to a problem? Please describe. I use loki.process --> stage.regex to extract named capture groups from a logline. These are:

Then I use loki.process --> stage.structured_metadata and use:

one of the next stages is: stage.match --> selector = "{process=\"alloy\"}" However this is not working because "process" is not a label but a struchtured_metadata.

Describe the solution you'd like stage.match selector should allow struchtured_metadata. maybe the default selector ist "label" and another option is "selector = struchtured_metadata".

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Loki docs always tell that you should avoid using "labels" if the information is already in the logs to avoid high cardinality and keep loki searches fast. For that reason structured_metadata seems to be a solution to avoid labels but keep the information in the log details. There should be the possibility to use struchtured_metadata in other processes, too.

Maybe there are other stages/components which use labels and may benefit from struchtured_metadata

Loki version 3.3.0

JStickler commented 3 days ago

Hi @Nachtfalkeaw, it sounds like this issue is something that should be reported against the Alloy repo, not the Loki repo. They Alloy team is the team that owns the processes you are describing in this issue.

Nachtfalkeaw commented 1 day ago

@JStickler You are probably right. I was not sure because alloy includes many components which sometimes are "only" merged from the "big brother". However I created a new issue on alloy github with reference to this. Maybe we can close this here?!

Link Grafana Alloy: https://github.com/grafana/alloy/issues/2191