# Tag events based in words in different fields

**URL:** <https://discuss.elastic.co/t/tag-events-based-in-words-in-different-fields/326382>\
**Category:** Logstash\
**Created:** [February 23, 2023, 11:35pm UTC](https://discuss.elastic.co/t/tag-events-based-in-words-in-different-fields/326382 "2023-02-23T23:35:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xalmer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xalmer/32/117685_2.png) [@xalmer](https://discuss.elastic.co/u/xalmer)\
**Post date:** [February 23, 2023, 11:35pm UTC](https://discuss.elastic.co/t/tag-events-based-in-words-in-different-fields/326382/1 "2023-02-23T23:35:04Z")

</div>

Hello everybody,

I want to make a better code, but i try a lot of thing and nothing works.  
I need to tag the input based in many words in 4 different fields.

Im doing like this, but need to replicate all the filter for a new field, like [oldtext].

Someone can help?

```auto
filter {
     if 
	"word1" in [text] or
	"word2" in [text] or
	"word3" in [text] or
	"word4" in [text] or
	"another word" in [text]
	
	{
          mutate { add_tag => "newtag" }
     }
}

```

---

<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:** [March 23, 2023, 11:35pm UTC](https://discuss.elastic.co/t/tag-events-based-in-words-in-different-fields/326382/2 "2023-03-23T23:35:29Z")

</div>

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