From 4f27c758df4f219a389d1b2d6d83dc273cd59101 Mon Sep 17 00:00:00 2001 From: Caleb Collins-Parks <46505081+caleb15@users.noreply.github.com> Date: Mon, 8 Mar 2021 05:43:13 -0800 Subject: [PATCH] add note about regex (#3437) to prevent people from running into https://github.com/grafana/loki/issues/3436 --- docs/sources/logql/_index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sources/logql/_index.md b/docs/sources/logql/_index.md index 0204c2215a..cc4db8580a 100644 --- a/docs/sources/logql/_index.md +++ b/docs/sources/logql/_index.md @@ -74,6 +74,8 @@ Examples: The same rules that apply for [Prometheus Label Selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors) apply for Loki log stream selectors. +**Important note:** The `=~` regex operator is fully anchored, meaning regex must match against the *entire* string, including newlines. The regex `.` character does not match newlines by default. If you want the regex dot character to match newlines you can use the single-line flag, like so: `(?s)search_term.+` matches `search_term\n`. + ### Log Pipeline A log pipeline can be appended to a log stream selector to further process and filter log streams. It usually is composed of one or multiple expressions, each expressions is executed in sequence for each log line. If an expression filters out a log line, the pipeline will stop at this point and start processing the next line.