# I want to save all \_grokparsefailure entries in a file to review them later, however

**URL:** <https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477>\
**Category:** Logstash\
**Created:** [May 20, 2021, 7:14am UTC](https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477 "2021-05-20T07:14:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stillfreem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stillfreem/32/85628_2.png) [@stillfreem](https://discuss.elastic.co/u/stillfreem)\
**Post date:** [May 20, 2021, 7:14am UTC](https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477/1 "2021-05-20T07:14:29Z")

</div>

My output configuration portion:

```
if "_grokparsefailure" in [tags] { file { path => "/home/myaccount/testfolder/grokfailures" file_mode => 0600 } }
  else
   {
    file { path => "/home/myaccount/testfolder/groksuccess" file_mode => 0600 }
   }

```

My grok filter works as a charm and all logs go into groksuccess.  
However, when I deliberately change the grok filter not to match my entries I can see them in `/var/log/logstash/logstash-plain.log` being tagged with `_grokparsefailure` and yet they don't go into my grokfailures file.

Any help please?

---

<div class="post-metadata">

**Author:** ![debrt](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@debrt](https://discuss.elastic.co/u/debrt)\
**Post date:** [May 20, 2021, 7:49am UTC](https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477/2 "2021-05-20T07:49:50Z")

</div>

I think the file plugin can only be used in the output object. So you would need to do it like this:

```auto
output {
    if "_grokparsefailure" in [tags] {
        file { 
            path => "/tmp/grok-failed.log"
        }      
    } 

```

---

<div class="post-metadata">

**Author:** ![stillfreem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stillfreem/32/85628_2.png) [@stillfreem](https://discuss.elastic.co/u/stillfreem)\
**Post date:** [May 20, 2021, 8:11am UTC](https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477/3 "2021-05-20T08:11:35Z")

</div>

Indeed my code snipped is from the output object and still not working. Very odd. Thank you for your reply anyway.

---

<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:** [May 20, 2021, 3:30pm UTC](https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477/4 "2021-05-20T15:30:19Z")

</div>

> [@stillfreem](#):
>
> `path => "/home/myaccount/testfolder/grokfailures" file_mode => 0600`

Does that file exist, and do you have permissions to write to it?

Try removing the file\_mode option, it [does not work](https://github.com/logstash-plugins/logstash-output-csv/issues/23) the way most folks would expect.

---

<div class="post-metadata">

**Author:** ![stillfreem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stillfreem/32/85628_2.png) [@stillfreem](https://discuss.elastic.co/u/stillfreem)\
**Post date:** [May 20, 2021, 6:40pm UTC](https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477/5 "2021-05-20T18:40:48Z")

</div>

Hi @Badger, yes the file didn't existed and I created it. I also removed the `file_mode` and again no joy. Again, as I said the funny thing is that file `groksuccess` receives all the logs but whey they are tagged with `_grokparsefailure` they just won't go into file `grokfailures`  
This is a single entry when I alter the regex to fail to match the logs and as you can see the `_grokparsefailure` tag is in there

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/8/58c54da2dd5ba00ae3ce3f6fe43c3f30ddbbf163.png)

---

<div class="post-metadata">

**Author:** ![stillfreem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stillfreem/32/85628_2.png) [@stillfreem](https://discuss.elastic.co/u/stillfreem)\
**Post date:** [May 31, 2021, 5:22am UTC](https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477/6 "2021-05-31T05:22:17Z")

</div>

Anyone else? Still haven't found a solution and its a bit frustrating.  
Thank you all in advanced.

---

<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:** [June 28, 2021, 5:23am UTC](https://discuss.elastic.co/t/i-want-to-save-all-grokparsefailure-entries-in-a-file-to-review-them-later-however/273477/7 "2021-06-28T05:23:06Z")

</div>

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