Using pattern and then filtering by label values

We just started using Loki instead of fluentbit. I came across using pattern for splitting logs to labels, and that too many labels means too much space. So it makes sense to have labels only when needed. However, I couldn’t find a way to apply pattern in logQL, and then filter on the parsed labels.

Any pointers to the documentation/examples is very welcome!

patterns are used like regex to extract labels from the logs - they don’t create actual labels. “Too much space” - I think you mean “too many streams” - which is what results when you send actual labels to loki in the log data. So using “patterns” to extract “labels” comes at no cost to storage AFAIK - and is faster than regex for the same use.
reference here for samples & explanation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.