# Drop message if tag is search and message has multiple strings

**URL:** <https://discuss.elastic.co/t/drop-message-if-tag-is-search-and-message-has-multiple-strings/200492>\
**Category:** Logstash\
**Created:** [September 20, 2019, 8:44pm UTC](https://discuss.elastic.co/t/drop-message-if-tag-is-search-and-message-has-multiple-strings/200492 "2019-09-20T20:44:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abinnd\_G](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Abinnd\_G](https://discuss.elastic.co/u/Abinnd_G)\
**Post date:** [September 20, 2019, 8:44pm UTC](https://discuss.elastic.co/t/drop-message-if-tag-is-search-and-message-has-multiple-strings/200492/1 "2019-09-20T20:44:42Z")

</div>

I am looking for dropping a message from the tag search if message has  
the following strings.

if "WARN" in [message] { drop{ } }  
if ".java:" in [message] { drop{ } }  
if "has open connections " in [message]

How can I achieve this, will the below approach work

filter {  
if "search" in [tags] and [message] =~ /(WARN|has open connections|.java:)/ { drop{} }  
}

---

<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 20, 2019, 8:50pm UTC](https://discuss.elastic.co/t/drop-message-if-tag-is-search-and-message-has-multiple-strings/200492/2 "2019-09-20T20:50:21Z")

</div>

I would expect that to work.

---

<div class="post-metadata">

**Author:** ![Abinnd\_G](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Abinnd\_G](https://discuss.elastic.co/u/Abinnd_G)\
**Post date:** [September 24, 2019, 10:46am UTC](https://discuss.elastic.co/t/drop-message-if-tag-is-search-and-message-has-multiple-strings/200492/3 "2019-09-24T10:46:55Z")

</div>

No its not working.

Messages are not getting dropped.

---

<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 22, 2019, 10:46am UTC](https://discuss.elastic.co/t/drop-message-if-tag-is-search-and-message-has-multiple-strings/200492/4 "2019-10-22T10:46:56Z")

</div>

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