@@ -40,7 +40,7 @@ delimiter-based pattern, and extracts the specified keys as columns.
4040For example, the following pattern:
4141[source,txt]
4242----
43- %{clientip} [%{@timestamp}] %{status}
43+ %{clientip} [%{@timestamp}] %{status}
4444----
4545
4646matches a log line of this format:
@@ -76,8 +76,8 @@ ignore certain fields, append fields, skip over padding, etc.
7676===== Terminology
7777
7878dissect pattern::
79- the set of fields and delimiters describing the textual
80- format. Also known as a dissection.
79+ the set of fields and delimiters describing the textual
80+ format. Also known as a dissection.
8181The dissection is described using a set of `%{}` sections:
8282`%{a} - %{b} - %{c}`
8383
@@ -91,14 +91,14 @@ Any set of characters other than `%{`, `'not }'`, or `}` is a delimiter.
9191key::
9292+
9393--
94- the text between the `%{` and `}`, exclusive of the `?`, `+`, `&` prefixes
95- and the ordinal suffix.
94+ the text between the `%{` and `}`, exclusive of the `?`, `+`, `&` prefixes
95+ and the ordinal suffix.
9696
9797Examples:
9898
99- * `%{?aaa}` - the key is `aaa`
100- * `%{+bbb/3}` - the key is `bbb`
101- * `%{&ccc}` - the key is `ccc`
99+ * `%{?aaa}` - the key is `aaa`
100+ * `%{+bbb/3}` - the key is `bbb`
101+ * `%{&ccc}` - the key is `ccc`
102102--
103103
104104[[esql-dissect-examples]]
@@ -218,7 +218,7 @@ Putting it together as an {esql} query:
218218
219219[source.merge.styled,esql]
220220----
221- include::{esql-specs}/docs.csv-spec[tag=grokWithEscape ]
221+ include::{esql-specs}/docs.csv-spec[tag=grokWithEscapeTripleQuotes ]
222222----
223223
224224`GROK` adds the following columns to the input table:
@@ -239,15 +239,24 @@ with a `\`. For example, in the earlier pattern:
239239%{IP:ip} \[%{TIMESTAMP_ISO8601:@timestamp}\] %{GREEDYDATA:status}
240240----
241241
242- In {esql} queries, the backslash character itself is a special character that
242+ In {esql} queries, when using single quotes for strings, the backslash character itself is a special character that
243243needs to be escaped with another `\`. For this example, the corresponding {esql}
244244query becomes:
245245[source.merge.styled,esql]
246246----
247247include::{esql-specs}/docs.csv-spec[tag=grokWithEscape]
248248----
249+
250+ For this reason, in general it is more convenient to use triple quotes `"""` for GROK patterns,
251+ that do not require escaping for backslash.
252+
253+ [source.merge.styled,esql]
254+ ----
255+ include::{esql-specs}/docs.csv-spec[tag=grokWithEscapeTripleQuotes]
256+ ----
249257====
250258
259+
251260[[esql-grok-patterns]]
252261===== Grok patterns
253262
@@ -318,4 +327,4 @@ as the `GROK` command.
318327The `GROK` command does not support configuring <<custom-patterns,custom
319328patterns>>, or <<trace-match,multiple patterns>>. The `GROK` command is not
320329subject to <<grok-watchdog,Grok watchdog settings>>.
321- // end::grok-limitations[]
330+ // end::grok-limitations[]
0 commit comments