# Logstash Handling Filter Errors

**URL:** <https://discuss.elastic.co/t/logstash-handling-filter-errors/287309>\
**Category:** Logstash\
**Created:** [October 21, 2021, 11:21am UTC](https://discuss.elastic.co/t/logstash-handling-filter-errors/287309 "2021-10-21T11:21:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maltewhiite](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maltewhiite/32/94551_2.png) [@maltewhiite](https://discuss.elastic.co/u/maltewhiite)\
**Post date:** [October 21, 2021, 11:21am UTC](https://discuss.elastic.co/t/logstash-handling-filter-errors/287309/1 "2021-10-21T11:21:35Z")

</div>

I want to handle errors in my Logstash Filter.

How do I do that? And more importantly, where is the documentation?

I can see there is Documentation here for Elastic Pipeline Error Handling:

> **[Ingest pipelines | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html#handling-pipeline-failures)**

Is there something similar for Logstash?

If I have a very specific Grok filter and if statements and mutates etc etc, and the Logs change, how will I know? Will the Logstash filter just crash? Will it ignore the errors? Will it stop sending those logs to Elastic?

If I could Tag each log that "misses" our Grok filters, with a tag like "error", then in Kibana I could find the logs that have changed, and now miss my Logstash Filters, just like we add\_tag =\> ["grokked"].

I basically want to read Documentation about handling Errors in Logstash, but I can't seem to find it via Google. I only find the Elastic pipeline error handling documentation.

Edit: I found this post from 2016, talking about Exception handling. Where can I find the Documentation for it? How does he know which tag will be put on after a failed parsing? He says:

> [@Exception Handling](https://discuss.elastic.co/t/exception-handling/38989/2):
>
> If the date parsing fails the message will by default get the tag \_dateparsefailure so you can do something like this: filter { date { ... } } output { if "\_dateparsefailure" in [tags] { file { path =\> ".../date\_parse\_errors.log" } } }

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [October 21, 2021, 11:29am UTC](https://discuss.elastic.co/t/logstash-handling-filter-errors/287309/2 "2021-10-21T11:29:09Z")

</div>

Errors are saved in an array named `tags`. For example Grok will add `_grokparsefailure` to that tag when something happens. Then you can do your error handling from that.

```auto
if "_grokparsefailure" in [tags] {
# do something
}

```

[\_grokparsefailure documentation](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html#plugins-filters-grok-tag_on_failure)  
[\_mutate\_error](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-tag_on_failure)

The `tag_on_failure` option is what you are looking for and you can set it to what you want or use the defaults.

---

<div class="post-metadata">

**Author:** ![maltewhiite](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maltewhiite/32/94551_2.png) [@maltewhiite](https://discuss.elastic.co/u/maltewhiite)\
**Post date:** [October 21, 2021, 11:31am UTC](https://discuss.elastic.co/t/logstash-handling-filter-errors/287309/3 "2021-10-21T11:31:20Z")

</div>

Thanks a lot Aaron. Lightning fast response. Hope you have a nice day! ❤

---

<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:** [November 18, 2021, 11:31am UTC](https://discuss.elastic.co/t/logstash-handling-filter-errors/287309/4 "2021-11-18T11:31:36Z")

</div>

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