# How to filter only error logs using filebeat

**URL:** <https://discuss.elastic.co/t/how-to-filter-only-error-logs-using-filebeat/216385>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 24, 2020, 7:48am UTC](https://discuss.elastic.co/t/how-to-filter-only-error-logs-using-filebeat/216385 "2020-01-24T07:48:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anindita\_Chavan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anindita_chavan/32/60755_2.png) [@Anindita\_Chavan](https://discuss.elastic.co/u/Anindita_Chavan)\
**Post date:** [January 24, 2020, 7:48am UTC](https://discuss.elastic.co/t/how-to-filter-only-error-logs-using-filebeat/216385/1 "2020-01-24T07:48:24Z")

</div>

Hello,  
i have a log file that contains INFO,WARN and ERROR like :

[17:37:17.103] [ERROR] [...] [.....]

these are log4j logs.  
Using filebeat, I want to filter out only those logs with log level ERROR and send them to logstash, can anybody tell me how to do this?  
Thank you for any help.

---

<div class="post-metadata">

**Author:** ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)\
**Post date:** [January 24, 2020, 9:24am UTC](https://discuss.elastic.co/t/how-to-filter-only-error-logs-using-filebeat/216385/2 "2020-01-24T09:24:40Z")

</div>

Hi @Anindita_Chavan

You can filter incoming log messages using filters and processors [https://www.elastic.co/guide/en/beats/filebeat/current/filtering-and-enhancing-data.html](https://www.elastic.co/guide/en/beats/filebeat/current/filtering-and-enhancing-data.html)

---

<div class="post-metadata">

**Author:** ![Anindita\_Chavan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anindita_chavan/32/60755_2.png) [@Anindita\_Chavan](https://discuss.elastic.co/u/Anindita_Chavan)\
**Post date:** [January 24, 2020, 9:53am UTC](https://discuss.elastic.co/t/how-to-filter-only-error-logs-using-filebeat/216385/3 "2020-01-24T09:53:34Z")

</div>

Hello @Mario_Castro,  
But isn't that solution for logs that start with the word ERROR INFO or DEBUG? What do I do if there is a timestamp in the beginning?  
Thank You.

---

<div class="post-metadata">

**Author:** ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)\
**Post date:** [January 24, 2020, 10:20am UTC](https://discuss.elastic.co/t/how-to-filter-only-error-logs-using-filebeat/216385/4 "2020-01-24T10:20:05Z")

</div>

It's a regex what you can use there. You can pretty much do everything with it (including working around the timestamp)

---

<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:** [February 21, 2020, 10:20am UTC](https://discuss.elastic.co/t/how-to-filter-only-error-logs-using-filebeat/216385/5 "2020-02-21T10:20:07Z")

</div>

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