# Filter with more than one possible match?

**URL:** <https://discuss.elastic.co/t/filter-with-more-than-one-possible-match/300292>\
**Category:** Logstash\
**Created:** [March 22, 2022, 8:16am UTC](https://discuss.elastic.co/t/filter-with-more-than-one-possible-match/300292 "2022-03-22T08:16:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andre22](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@andre22](https://discuss.elastic.co/u/andre22)\
**Post date:** [March 22, 2022, 8:16am UTC](https://discuss.elastic.co/t/filter-with-more-than-one-possible-match/300292/1 "2022-03-22T08:16:22Z")

</div>

Hi,

I'm running the Elastic stack 8.1

I want to create a filter that has more than one condition and therefore avoid creating the same filter for all possibilities again and again. An example: I want the IF condition to apply when the field "method" contains one of these values: "reply", "reply[A]", "reply[AAAA]".

My last attempt looks like this:

```
if [method] == ["reply", "reply[A]", "reply[AAA]"] {
  grok {...

```

but it doesn't seem to work.

In another filter, I would like to query wether the tag content is stored in a local text file, delimited for example by newline or comma. Is that possible, and if so, how?

Thanks for your help!

---

<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:** [March 22, 2022, 11:54am UTC](https://discuss.elastic.co/t/filter-with-more-than-one-possible-match/300292/2 "2022-03-22T11:54:44Z")

</div>

You can do this with a few `or` statements or the second option is using regex where if `reply` shows up anywhere in the value then it will match.

```auto
if [method] == "reply" or [method] == "reply[A]" or [method] == "reply[AAA]"

```

or

```auto
if [method] =~ /reply/

```

---

<div class="post-metadata">

**Author:** ![andre22](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@andre22](https://discuss.elastic.co/u/andre22)\
**Post date:** [March 22, 2022, 3:21pm UTC](https://discuss.elastic.co/t/filter-with-more-than-one-possible-match/300292/3 "2022-03-22T15:21:57Z")

</div>

Thank you @aaron-nimocks !

I solved it in the meantime, found a similar approach:

if [method] =~ /^repl\*/ {mutate { ...

More examples like the one you provided would be great in the documentation.

I am now trying to solve the "look for the string in a file" question.  
My approach so far is to use "translate" and "csv", and add a tag or field when the string is found. But for sure there is a more elegant approach?

---

<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:** [April 19, 2022, 3:22pm UTC](https://discuss.elastic.co/t/filter-with-more-than-one-possible-match/300292/4 "2022-04-19T15:22:17Z")

</div>

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