# Compare multiple types in if in logstash

**URL:** <https://discuss.elastic.co/t/compare-multiple-types-in-if-in-logstash/84668>\
**Category:** Logstash\
**Created:** [May 5, 2017, 7:15am UTC](https://discuss.elastic.co/t/compare-multiple-types-in-if-in-logstash/84668 "2017-05-05T07:15:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sLuvpreet33](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sluvpreet33/32/50626_2.png) [@sLuvpreet33](https://discuss.elastic.co/u/sLuvpreet33)\
**Post date:** [May 5, 2017, 7:15am UTC](https://discuss.elastic.co/t/compare-multiple-types-in-if-in-logstash/84668/1 "2017-05-05T07:15:01Z")

</div>

What is the proper syntax of comparing multiple types in logstash ?

like,

```
if[type] == grafana OR netdata { # is this correct ?
 }
else if[type] == {
}
else {
}
```

---

<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:** [May 5, 2017, 7:17am UTC](https://discuss.elastic.co/t/compare-multiple-types-in-if-in-logstash/84668/2 "2017-05-05T07:17:22Z")

</div>

Either

```
if [type] == "grafana" OR [type] == "netdata" { 

```

or

```
if [type] in ["grafana", "netdata"] { 

```

See [https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html).

---

<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:** [June 2, 2017, 7:31am UTC](https://discuss.elastic.co/t/compare-multiple-types-in-if-in-logstash/84668/3 "2017-06-02T07:31:19Z")

</div>

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