Test a Grok pattern Added in 8.13.0
Test a Grok pattern on one or more lines of text. The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings.
Query parameters
-
ecs_compatibility string
The mode of compatibility with ECS compliant Grok patterns. Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. Valid values are
disabled
andv1
.
Body Required
-
The lines of text to run the Grok pattern on.
GET
/_text_structure/test_grok_pattern
curl \
-X GET http://api.example.com/_text_structure/test_grok_pattern \
-H "Content-Type: application/json" \
-d '{"grok_pattern":"string","text":["string"]}'
Request examples
{
"grok_pattern": "string",
"text": [
"string"
]
}
Response examples (200)
{
"matches": [
{
"matched": true,
"fields": {
"additionalProperty1": [
{
"match": "string",
"offset": 42.0,
"length": 42.0
}
],
"additionalProperty2": [
{
"match": "string",
"offset": 42.0,
"length": 42.0
}
]
}
}
]
}