# Please, I need help with grok patterns

**URL:** <https://discuss.elastic.co/t/please-i-need-help-with-grok-patterns/218246>\
**Category:** Logstash\
**Created:** [February 6, 2020, 7:51pm UTC](https://discuss.elastic.co/t/please-i-need-help-with-grok-patterns/218246 "2020-02-06T19:51:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fern148](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fern148/32/62227_2.png) [@Fern148](https://discuss.elastic.co/u/Fern148)\
**Post date:** [February 6, 2020, 7:51pm UTC](https://discuss.elastic.co/t/please-i-need-help-with-grok-patterns/218246/1 "2020-02-06T19:51:30Z")

</div>

Hello! All right?

Please, I need help with grok patterns.  
When I test with Dev Tools -\> Grok Debugger it works perfectly, but when I include it in the logstash filter it returns \_grokparsefailure.  
Is there a way to capture \_grokparsefailure response?  
Below is my configuration.  
Thanks for any help.

> input {  
> kafka {  
> bootstrap\_servers =\> "localhost:9092"  
> topics =\> "application"  
> tags =\> ["application"]  
> codec =\> json  
> }  
> }  
> filter {  
> if "application" in [tags] {  
> if [action][id] == "export\_send" {  
> grok {  
> patterns\_dir =\> ["/etc/logstash/patterns"]  
> match =\> { "newValue" =\> "%{NEWVALUE}" }  
> }  
> mutate {  
> add\_tag =\> ["YES\_Export"]  
> }  
> }  
> }  
> }  
> output {  
> if "application" in [tags] {  
> #stdout { codec =\> "rubydebug"}  
> elasticsearch {  
> hosts =\> ["localhost:9200"]  
> index =\> "application-%{+YYYY}"  
> }  
> }  
> }

**Pattern**

> cat patterns/application  
> NEWVALUE Output: %{DATA:output}\\nExport name: %{DATA:export\_name}\\nExport file format: %{DATA:export\_file\_format}\\nAmount requested: %{DATA:amount\_requested}\\n\\nLast balance: %{DATA:last\_balance}\\nCurrent balance: %{DATA:current\_balance}\\n\\nSearched fields and terms: %{DATA:search}\\n\\tIdentifiers: %{DATA:identifiers}\\n%{GREEDYDATA}

**stdout { codec =\> "rubydebug"}**

> {  
> "action" =\> {  
> "id" =\> "export\_send"  
> },  
> "input" =\> {  
> "type" =\> "log"  
> },  
> "restrict" =\> "{\n "outputId": "1",\n "pks": [\n "04475444000129"\n]\n}",  
> "log" =\> {  
> "file" =\> {  
> "path" =\> "/home/fernandosilveira/audit/logs2/audit.json"  
> },  
> "offset" =\> 3049695  
> },  
> "client" =\> {  
> "name" =\> "QQ",  
> "id" =\> "2"  
> },  
> "id" =\> "5e3c695ede62250006c010a8",  
> "@timestamp" =\> 2020-02-06T19:31:13.083Z,  
> "fields" =\> {  
> "application" =\> "test"  
> },  
> "ecs" =\> {  
> "version" =\> "1.1.0"  
> },  
> "host" =\> {  
> "name" =\> "fernando"  
> },  
> "date" =\> "2020-02-06T19:30:38.499Z",  
> "@version" =\> "1",  
> "app" =\> {  
> "label" =\> "SearchBar",  
> "id" =\> "searchbar"  
> },  
> "newValue" =\> "Output: Export (1)\nExport name: test123\nExport file format: salesforce\nAmount requested: 1\n\nLast balance: 43087128\nCurrent balance: 43087127\n\nSearched fields and terms: \n\tIdentifiers: 04475444000129\n\n\n\n",  
> "user" =\> {  
> "username" =\> "[XXXX@YYYY.com](mailto:XXXX@YYYY.com)",  
> "id" =\> "5ac51bcbf623ed00057bf2ad",  
> "name" =\> "Fernando Silveira"  
> },  
> "agent" =\> {  
> "ephemeral\_id" =\> "ffec81ae-cb49-4911-86c0-d873d499fb30",  
> "id" =\> "235312ef-7660-4f62-bc95-58f1bb8cd4e4",  
> "type" =\> "filebeat",  
> "version" =\> "7.5.2",  
> "hostname" =\> "fernando"  
> },  
> "address" =\> "ttt.ttt.ttt.ttt",  
> "tags" =\> [  
> [0] "application",  
> [1] "\_grokparsefailure",  
> [2] "YES\_Export"  
> ]  
> }

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 6, 2020, 8:24pm UTC](https://discuss.elastic.co/t/please-i-need-help-with-grok-patterns/218246/2 "2020-02-06T20:24:08Z")

</div>

When I run

```
input { generator { count => 1 lines => [ 'Output: Export (1)
Export name: test123
Export file format: salesforce
Amount requested: 1

Last balance: 43087128
Current balance: 43087127

Searched fields and terms:
    Identifiers: 04475444000129

' ] } }
filter {
    grok {
        match => {
            "message" => "Output: %{DATA:output}\\nExport name: %{DATA:export_name}\\nExport file format: %{DATA:export_file_format}\\nAmount requested: %{DATA:amount_requested}\\n\\nLast balance: %{DATA:last_balance}\\nCurrent balance: %{DATA:current_balance}\\n\\nSearched fields and terms: %{DATA:search}\\n\\tIdentifiers: %{DATA:identifiers}\\n%{GREEDYDATA}"
        }
    }
}
output { stdout { codec => rubydebug { metadata => false } } }

```

It works fine for me...

```
       "identifiers" => "04475444000129",
"export_file_format" => "salesforce",
       "export_name" => "test123",

```

etc. I suggest you read [this](https://discuss.elastic.co/t/help-needed-in-grok/213827/2).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 5, 2020, 8:24pm UTC](https://discuss.elastic.co/t/please-i-need-help-with-grok-patterns/218246/3 "2020-03-05T20:24:13Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
