# Logstash if any array element exists in \[tags\]

**URL:** https://discuss.elastic.co/t/logstash-if-any-array-element-exists-in-tags/77808
**Category:** Logstash
**Created:** [March 8, 2017, 11:53am UTC](https://discuss.elastic.co/t/logstash-if-any-array-element-exists-in-tags/77808 "2017-03-08T11:53:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Exocomp](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@Exocomp](https://discuss.elastic.co/u/Exocomp)
#### Post date: [March 8, 2017, 11:53am UTC](https://discuss.elastic.co/t/logstash-if-any-array-element-exists-in-tags/77808/1 "2017-03-08T11:53:03Z")

</div>

Hi,

Is there a way to do a conditional check such that elements of any array element exists in [tags] ?, something like:

if ["element1", "element2", "element3"] in [tags] {

}

Thanks,  
E

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [March 9, 2017, 3:21pm UTC](https://discuss.elastic.co/t/logstash-if-any-array-element-exists-in-tags/77808/2 "2017-03-09T15:21:38Z")

</div>

You have to do this:

```
if "element1" in [tags] or "element2" in [tags] or "element3" in [tags] {
```

---

<div class="post-metadata">

### Author: ![Exocomp](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@Exocomp](https://discuss.elastic.co/u/Exocomp)
#### Post date: [March 9, 2017, 5:38pm UTC](https://discuss.elastic.co/t/logstash-if-any-array-element-exists-in-tags/77808/3 "2017-03-09T17:38:04Z")

</div>

@magnusbaeck

Ok, I'll settle for that but I was hoping for something cleaner.

Thanks,  
E

---

<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 6, 2017, 5:38pm UTC](https://discuss.elastic.co/t/logstash-if-any-array-element-exists-in-tags/77808/4 "2017-04-06T17:38:21Z")

</div>

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