Skip to content

Commit 19ddb25

Browse files
github-actions[bot]natebowerkolchfa-aws
committed
Note that grok ingest processor patterns are not anchored (#11182)
* Note that grok ingest processor patterns are not anchored Signed-off-by: James Beckett <[email protected]> * Grok ingest processor: add anchoring to pattern examples Signed-off-by: James Beckett <[email protected]> * Update _ingest-pipelines/processors/grok.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Nathan Bower <[email protected]> --------- Signed-off-by: James Beckett <[email protected]> Signed-off-by: Nathan Bower <[email protected]> Co-authored-by: Nathan Bower <[email protected]> Co-authored-by: kolchfa-aws <[email protected]> (cherry picked from commit cbecfc1) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 34e4e43 commit 19ddb25

File tree

1 file changed

+6
-3
lines changed
  • _ingest-pipelines/processors

1 file changed

+6
-3
lines changed

_ingest-pipelines/processors/grok.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ For a list of available predefined patterns, see [Grok patterns](https://github.
2121

2222
The `grok` processor is built on the [Oniguruma regular expression library](https://github.com/kkos/oniguruma/blob/master/doc/RE) and supports all the patterns from that library. You can use the [Grok Debugger](https://grokdebugger.com/) tool to test and debug your grok expressions.
2323

24+
Note that patterns are *not anchored*. For performance and reliability, include a start-of-line anchor (`^`) in your pattern.
25+
{: .note}
26+
2427
## Syntax
2528

2629
The following is the basic syntax for the `grok` processor:
@@ -69,7 +72,7 @@ PUT _ingest/pipeline/log_line
6972
{
7073
"grok": {
7174
"field": "message",
72-
"patterns": ["%{IPORHOST:clientip} %{HTTPDATE:timestamp} %{NUMBER:response_status:int}"]
75+
"patterns": ["^%{IPORHOST:clientip} %{HTTPDATE:timestamp} %{NUMBER:response_status:int}"]
7376
}
7477
}
7578
]
@@ -158,7 +161,7 @@ PUT _ingest/pipeline/log_line
158161
{
159162
"grok": {
160163
"field": "message",
161-
"patterns": ["The issue number %{NUMBER:issue_number} is %{STATUS:status}"],
164+
"patterns": ["^The issue number %{NUMBER:issue_number} is %{STATUS:status}"],
162165
"pattern_definitions" : {
163166
"NUMBER" : "\\d{3,4}",
164167
"STATUS" : "open|closed"
@@ -182,7 +185,7 @@ PUT _ingest/pipeline/log_line
182185
{
183186
"grok": {
184187
"field": "message",
185-
"patterns": ["%{HTTPDATE:timestamp} %{IPORHOST:clientip}", "%{IPORHOST:clientip} %{HTTPDATE:timestamp} %{NUMBER:response_status:int}"],
188+
"patterns": ["^%{HTTPDATE:timestamp} %{IPORHOST:clientip}", "%{IPORHOST:clientip} %{HTTPDATE:timestamp} %{NUMBER:response_status:int}"],
186189
"trace_match": true
187190
}
188191
}

0 commit comments

Comments
 (0)