# Why is this logstah filter not working as intended?

**URL:** <https://discuss.elastic.co/t/why-is-this-logstah-filter-not-working-as-intended/244874>\
**Category:** Logstash\
**Created:** [August 13, 2020, 12:01pm UTC](https://discuss.elastic.co/t/why-is-this-logstah-filter-not-working-as-intended/244874 "2020-08-13T12:01:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drjosephliu](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@drjosephliu](https://discuss.elastic.co/u/drjosephliu)\
**Post date:** [August 13, 2020, 12:01pm UTC](https://discuss.elastic.co/t/why-is-this-logstah-filter-not-working-as-intended/244874/1 "2020-08-13T12:01:59Z")

</div>

Sorry if this is too related to my previous post, but here goes:

I have two types of messages that I want to send to logstash. One is a "standard" log type message and the other is a JSON object. I only want the message to go through the json filter **only** if it fails the grok filter. For some reason though, none of the json objects are being parsed, nor are they getting tagged with `_grokparsefailure` either. In fact, I can't see them at all in kibana. What am I doing wrong here?

```
filter {
  grok {
    match => { "message" =>
    "\[%{TIMESTAMP_ISO8601:log_time}\]\[%{LOGLEVEL:log_level}\s*\]\[%{DATA:thread_name}\]\[%{DATA:class_name}\]%{GREEDYDATA:log_msg}" }
  }
  if "_grokparsefailure" in [tags] {
    json {
      source => "message"
      add_tag => ["RiskExplain"]
      # remove_tag => ["_grokparsefailure"]
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [August 16, 2020, 8:06am UTC](https://discuss.elastic.co/t/why-is-this-logstah-filter-not-working-as-intended/244874/2 "2020-08-16T08:06:25Z")

</div>

Hi there,

can you try outputting to stdout and let us know what your logs look like? Thanks!

---

<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:** [September 13, 2020, 8:06am UTC](https://discuss.elastic.co/t/why-is-this-logstah-filter-not-working-as-intended/244874/3 "2020-09-13T08:06:34Z")

</div>

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