# Logstash filter plugin

**URL:** <https://discuss.elastic.co/t/logstash-filter-plugin/283847>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [September 10, 2021, 8:14am UTC](https://discuss.elastic.co/t/logstash-filter-plugin/283847 "2021-09-10T08:14:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorinand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorinand/32/70521_2.png) [@dorinand](https://discuss.elastic.co/u/dorinand)\
**Post date:** [September 10, 2021, 8:14am UTC](https://discuss.elastic.co/t/logstash-filter-plugin/283847/1 "2021-09-10T08:14:02Z")

</div>

I am using Logstash version 7.14.0. I would like to parse message to the top level of message. So this is my configuration:

```auto
        json {
          skip_on_invalid_json => true
          source => "message"
          tag_on_failure => ["_jsonparsefailure"]
        }

```

When the message is JSON, it works. If message is not JSON, I would expect that the message will be tagged with `_jsonparsefailure` but it is not true. From the documentation, I can see that with setting `skip_on_invalid_json => true` the json filter will be skipped so I assume it will also skipped the tagging?

I would expect from this configuratoin that in case, message is not JSON, it will just tag the message but not print any warning into logs - because of `skip_on_invalid_json => true`.

Now I do not know how to filter messages which are not json.

Could anybody explain me if I understand correctly and explain, how to achieve to tag a not JSON messages ?

Thank you.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [September 10, 2021, 2:12pm UTC](https://discuss.elastic.co/t/logstash-filter-plugin/283847/2 "2021-09-10T14:12:20Z")

</div>

Both the error message and the tagging are conditional upon the same option in the [code](https://github.com/logstash-plugins/logstash-filter-json/blob/4d54cceab462a6e8f39d48bd72beba9b796a97be/lib/logstash/filters/json.rb#L87). You cannot get one without the other.

---

<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:** [October 8, 2021, 2:12pm UTC](https://discuss.elastic.co/t/logstash-filter-plugin/283847/3 "2021-10-08T14:12:53Z")

</div>

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