# How to write logical or(||) in logstash

**URL:** <https://discuss.elastic.co/t/how-to-write-logical-or-in-logstash/188794>\
**Category:** Logstash\
**Created:** [July 3, 2019, 6:31pm UTC](https://discuss.elastic.co/t/how-to-write-logical-or-in-logstash/188794 "2019-07-03T18:31:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![naveenrt23](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@naveenrt23](https://discuss.elastic.co/u/naveenrt23)\
**Post date:** [July 3, 2019, 6:31pm UTC](https://discuss.elastic.co/t/how-to-write-logical-or-in-logstash/188794/1 "2019-07-03T18:31:12Z")

</div>

Hello,

How can I write a logical or operator for two values?

I've tried `if [type] == "test-request" || [type] == "test1-request"` but this gives me a syntax error.  
I want it to work on how a logical OR operator works. If type value matches either one then true else false.

---

<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:** [July 3, 2019, 6:44pm UTC](https://discuss.elastic.co/t/how-to-write-logical-or-in-logstash/188794/2 "2019-07-03T18:44:00Z")

</div>

Use the word or

---

<div class="post-metadata">

**Author:** ![naveenrt23](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@naveenrt23](https://discuss.elastic.co/u/naveenrt23)\
**Post date:** [July 3, 2019, 6:57pm UTC](https://discuss.elastic.co/t/how-to-write-logical-or-in-logstash/188794/3 "2019-07-03T18:57:55Z")

</div>

sorry for the trouble. Got confused going through multiple documents.

Ruby logical operator on [tutorialspoint](https://www.tutorialspoint.com/ruby/ruby_operators.htm) gives another description of how "or" is used. so I wasn't sure if that works.

"Called Logical OR Operator. If any of the two operands are non zero, then the condition becomes true."

---

<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:** [July 31, 2019, 6:58pm UTC](https://discuss.elastic.co/t/how-to-write-logical-or-in-logstash/188794/4 "2019-07-31T18:58:02Z")

</div>

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