Search code examples
elasticsearchlogstashlogstash-grok

Grok Pattern escaping a - (hyphen)


I want to write a grok pattern for something like 123-543, which is two numbers separated by a hyphen. I've written a grok %{NUMBER:num1}-%{NUMBER:num2} by escaping the hyphen but it's not working. Alsi attached a screenshot by testing it on a online grok debugger. Can someone help me? enter image description here


Solution

  • Please find the grok pattern here:

    %{INT:num1}\-%{INT:num2}
    

    Output:

    enter image description here