# How can i filter errors in filebeat

**URL:** <https://discuss.elastic.co/t/how-can-i-filter-errors-in-filebeat/273893>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [May 25, 2021, 6:21am UTC](https://discuss.elastic.co/t/how-can-i-filter-errors-in-filebeat/273893 "2021-05-25T06:21:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_perez](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@Martin\_perez](https://discuss.elastic.co/u/Martin_perez)\
**Post date:** [May 25, 2021, 6:21am UTC](https://discuss.elastic.co/t/how-can-i-filter-errors-in-filebeat/273893/1 "2021-05-25T06:21:03Z")

</div>

Hi, I have an elk stack mounted, which receives data from two filebeats.  
I want to configure my filebeat configuration files so that it only collects files whose error is anything other than 500, and I have tried to do a grep on the "path" line, to try to touch the include or exclude lines ... but I keep getting the same logs, it does not exclude or include anything. What can be?

```auto
  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - /server/www/html/*/logs/error.log | grep -v "200" | grep "2021"
    #- c:\programdata\elasticsearch\logs\*

  # Exclude lines. A list of regular expressions to match. It drops the lines that are
  # matching any regular expression from the list.
  exclude_lines: ['200']

  # Include lines. A list of regular expressions to match. It exports the lines that are
  # matching any regular expression from the list.
  include_lines: ['400', '500']

```

Many thanks in advance, greetings

---

<div class="post-metadata">

**Author:** ![mtojek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtojek/32/63863_2.png) [@mtojek](https://discuss.elastic.co/u/mtojek)\
**Post date:** [May 25, 2021, 8:23am UTC](https://discuss.elastic.co/t/how-can-i-filter-errors-in-filebeat/273893/2 "2021-05-25T08:23:59Z")

</div>

Did you at this thread before: [Filebeat exclude line not working :( - #2 by robscott27](https://discuss.elastic.co/t/filebeat-exclude-line-not-working/113358/2) ? I think it's similar.

---

<div class="post-metadata">

**Author:** ![Martin\_perez](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@Martin\_perez](https://discuss.elastic.co/u/Martin_perez)\
**Post date:** [May 27, 2021, 6:46am UTC](https://discuss.elastic.co/t/how-can-i-filter-errors-in-filebeat/273893/4 "2021-05-27T06:46:31Z")

</div>

Yes, also i tried like that post and other many ways  
`exclude_files: ['*.200.* ']`  
`exclude_files: [' 200 ']`

but, neither of them works, filebeat is working but i don´t get logs

---

<div class="post-metadata">

**Author:** ![mtojek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtojek/32/63863_2.png) [@mtojek](https://discuss.elastic.co/u/mtojek)\
**Post date:** [May 27, 2021, 7:38am UTC](https://discuss.elastic.co/t/how-can-i-filter-errors-in-filebeat/273893/5 "2021-05-27T07:38:13Z")

</div>

Hm.. did you try the directive `exclude_files` or `exclude_lines`?

---

<div class="post-metadata">

**Author:** ![Martin\_perez](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@Martin\_perez](https://discuss.elastic.co/u/Martin_perez)\
**Post date:** [May 27, 2021, 8:20am UTC](https://discuss.elastic.co/t/how-can-i-filter-errors-in-filebeat/273893/6 "2021-05-27T08:20:14Z")

</div>

this is my config file, and I receive all kinds of logs, that is, the exclude\_lines or include\_lines lines are not affecting me

```auto
  paths:
    - /server/www/html/*/logs/*.log | grep "27/May"
  exclude_lines: ['^200']
  exclude_files: ['^200']

```

the type of logs on kibana that I wish they did not appear are like this

```auto
192.168.x.x - - [27/May/2021:10:05:45 +0200] "GET /sistemas/noticias/x HTTP/1.1" 200 879 "http://x/sistemas/noticias/x" "Mozilla/5.0 (X11; Linux armv7l)x/537.36 (KHTML, like Gecko) Raspbian x/65.0.3325.181 x/65.0.3325.181 x/537.36"

```

---

<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 24, 2021, 10:20am UTC](https://discuss.elastic.co/t/how-can-i-filter-errors-in-filebeat/273893/7 "2021-06-24T10:20:39Z")

</div>

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