# Nand and xor operators not working

**URL:** <https://discuss.elastic.co/t/nand-and-xor-operators-not-working/31972>\
**Category:** Logstash\
**Created:** [October 11, 2015, 4:56pm UTC](https://discuss.elastic.co/t/nand-and-xor-operators-not-working/31972 "2015-10-11T16:56:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RajkumarV](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@RajkumarV](https://discuss.elastic.co/u/RajkumarV)\
**Post date:** [October 11, 2015, 4:56pm UTC](https://discuss.elastic.co/t/nand-and-xor-operators-not-working/31972/1 "2015-10-11T16:56:45Z")

</div>

Hi

I am using logstash 1.5.4 version on Ubuntu 14.04. I am unable to make use of nand, xor operator in conditionals.

The error resulted and the configuration used for xor operator example is given below: (similar error appears for nand operator as well)

**_Error:_**

_SyntaxError: (eval):22: syntax error, unexpected tIDENTIFIER_  
_if (((x = event["[type]"]; x.respond\_to?(:include?) && x.include?(("cwout")))) xor (event["[type]"] == ("cricket"))) # if "cwout" in [type] xor [type] == "cricket"_  
_^_  
_eval at org/jruby/RubyKernel.java:1111_  
_initialize at /logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:31_  
_execute at /logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/agent.rb:114_  
_run at /logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/runner.rb:90_  
_call at org/jruby/RubyProc.java:271_  
_run at /logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/runner.rb:95_  
_call at org/jruby/RubyProc.java:271_  
_initialize at /logstash-1.5.4/vendor/bundle/jruby/1.9/gems/stud-0.0.22/lib/stud/task.rb:24_

**_Configuration used is:_**

input  
{  
stdin  
{  
type =\> "stdin-input"  
}  
}  
output  
{  
if "cwout" in [type] xor [type] == "cricket"  
{  
stdout {}  
}  
}

Can anyone tell me the solution for this ?

---

<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:** [October 11, 2015, 7:34pm UTC](https://discuss.elastic.co/t/nand-and-xor-operators-not-working/31972/2 "2015-10-11T19:34:49Z")

</div>

AFAICT this is a bug in Logstash. I've reported it as [github.com/elastic/logstash issue #4012](https://github.com/elastic/logstash/issues/4012). You can obviously work around the bug by rewriting the expression.

---

<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 6, 2017, 5:26am UTC](https://discuss.elastic.co/t/nand-and-xor-operators-not-working/31972/3 "2017-07-06T05:26:54Z")

</div>

Closed on July 6, 2017, 5:26am UTC


