# Logstash : Filter Error message from Logs

**URL:** <https://discuss.elastic.co/t/logstash-filter-error-message-from-logs/161857>\
**Category:** Logstash\
**Created:** [December 21, 2018, 2:31pm UTC](https://discuss.elastic.co/t/logstash-filter-error-message-from-logs/161857 "2018-12-21T14:31:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moulika\_Magatapalli1](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@Moulika\_Magatapalli1](https://discuss.elastic.co/u/Moulika_Magatapalli1)\
**Post date:** [December 21, 2018, 2:31pm UTC](https://discuss.elastic.co/t/logstash-filter-error-message-from-logs/161857/1 "2018-12-21T14:31:57Z")

</div>

Hi , I am using Logstash to parse and filter the data. The input data looks something like this:

```
------------------------------------------------------
Environment File - 12/07/2018 09:31:19
------------------------------------------------------
-- File Name: org/apache/catalina/core/ContainerBase/jboss/web/default-host/........... Path
------------------------------------------------------
Reading Environment Error File - 12/07/2018 09:31:19
------------------------------------------------------
-- File Name: org/apache/catalina/core/ContainerBase/jboss/web/default-host/.....
org/apache/catalina/core/ContainerBase/jboss/web/default-host........
.....Path. Fri Dec 7 09:31:18 2018

Lock failed on recovery file org/apache/catalina/core/ContainerBase/jboss/web/default-host/
because the .......
....... text.

------------------------------------------------------
Reading Error Files - 12/07/2018 09:31:19
------------------------------------------------------

```

The Error message contains multiple lines and no common pattern. How to filter Errors only from logs ?

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [December 24, 2018, 4:29am UTC](https://discuss.elastic.co/t/logstash-filter-error-message-from-logs/161857/2 "2018-12-24T04:29:42Z")

</div>

This is a multi-line log. How are you consuming this data?

Filtering data should ideally be done as close to the source of data. If you are using Filebeat, they have multi-line support. You could use the regex check to consume only the data that you need.

---

<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:** [January 21, 2019, 4:29am UTC](https://discuss.elastic.co/t/logstash-filter-error-message-from-logs/161857/3 "2019-01-21T04:29:55Z")

</div>

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