Skip to content

Simulation results are not updated when the order of Grok patterns changes #126787

Open
@gbamparop

Description

@gbamparop

The simulation results are not updated when the order of Grok patterns changes in the _ingest/pipeline/_simulate API.

Steps to replicate

POST _ingest/pipeline/_simulate
{
  "docs": [
    {
      "_source": {
        "message": "2025-04-14 17:19:15,898 FATAL [main] com.example3.util.JsonParser - Invalid JSON encountered: {invalid_key:missing_value}"
      }
    }
  ],
  "pipeline": {
    "processors": [
      {
        "grok": {
          "field": "message",
          "patterns": [
            "%{LOGLEVEL:the_loglevel}"
          ]
        }
      }
    ]
  }
}

returns "the_loglevel": "FATAL",

POST _ingest/pipeline/_simulate
{
  "docs": [
    {
      "_source": {
        "message": "2025-04-14 17:19:15,898 FATAL [main] com.example3.util.JsonParser - Invalid JSON encountered: {invalid_key:missing_value}"
      }
    }
  ],
  "pipeline": {
    "processors": [
      {
        "grok": {
          "field": "message",
          "patterns": [
            "%{LOGLEVEL:the_loglevel}",
            "%{WORD:the_word}"
          ]
        }
      }
    ]
  }
}

returns "the_word": "2025"

POST _ingest/pipeline/_simulate
{
  "docs": [
    {
      "_source": {
        "message": "2025-04-14 17:19:15,898 FATAL [main] com.example3.util.JsonParser - Invalid JSON encountered: {invalid_key:missing_value}"
      }
    }
  ],
  "pipeline": {
    "processors": [
      {
        "grok": {
          "field": "message",
          "patterns": [
            "%{WORD:the_word}",
            "%{LOGLEVEL:the_loglevel}"
           
          ]
        }
      }
    ]
  }
}

returns "the_word": "2025"

Related to elastic/kibana#218135

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions