# Convert boolean fails on TrueClass

**URL:** <https://discuss.elastic.co/t/convert-boolean-fails-on-trueclass/73480>\
**Category:** Logstash\
**Created:** [February 1, 2017, 8:29am UTC](https://discuss.elastic.co/t/convert-boolean-fails-on-trueclass/73480 "2017-02-01T08:29:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevie/32/23394_2.png) [@stevie](https://discuss.elastic.co/u/stevie)\
**Post date:** [February 1, 2017, 8:29am UTC](https://discuss.elastic.co/t/convert-boolean-fails-on-trueclass/73480/1 "2017-02-01T08:29:56Z")

</div>

- Version: logstash 1:5.1.2-1
- Operating System: Linux [elk-1.domain.net](http://elk-1.domain.net) 3.13.0-105-generic #152-Ubuntu SMP Fri Dec 2 15:37:11 UTC 2016 x86\_64 x86\_64 x86\_64 GNU/Linux
- Config File (if you have sensitive info, please remove it):

```auto
filter {
        mutate {
            convert => ["IsMobile", "boolean"]
        }
}

```

```auto
[2017-02-01T08:01:58,808][ERROR][logstash.pipeline] Exception in pipelineworker, the pipeline stopped processi
ng new events, please check your filter configuration and restart Logstash. {"exception"=>#<NoMethodError: undefined m
ethod `empty?' for true:TrueClass>, "backtrace"=>["/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-mu
tate-3.1.3/lib/logstash/filters/mutate.rb:284:in `convert_boolean'", "org/jruby/RubyMethod.java:120:in `call'", "/usr/
share/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-mutate-3.1.3/lib/logstash/filters/mutate.rb:258:in `conver
t'", "org/jruby/RubyHash.java:1342:in `each'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-mutat
e-3.1.3/lib/logstash/filters/mutate.rb:244:in `convert'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-f
ilter-mutate-3.1.3/lib/logstash/filters/mutate.rb:206:in `filter'", "/usr/share/logstash/logstash-core/lib/logstash/fi
lters/base.rb:145:in `do_filter'", "/usr/share/logstash/logstash-core/lib/logstash/filters/base.rb:164:in `multi_filte
r'", "org/jruby/RubyArray.java:1613:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/filters/base.rb:161:in
 `multi_filter'", "/usr/share/logstash/logstash-core/lib/logstash/filter_delegator.rb:41:in `multi_filter'", "(eval):6
033:in `initialize'", "org/jruby/RubyArray.java:1613:in `each'", "(eval):6030:in `initialize'", "org/jruby/RubyProc.ja
va:281:in `call'", "(eval):6167:in `initialize'", "org/jruby/RubyArray.java:1613:in `each'", "(eval):6158:in `initiali
ze'", "org/jruby/RubyProc.java:281:in `call'", "(eval):1088:in `filter_func'", "/usr/share/logstash/logstash-core/lib/
logstash/pipeline.rb:295:in `filter_batch'", "org/jruby/RubyProc.java:281:in `call'", "/usr/share/logstash/logstash-co
re/lib/logstash/util/wrapped_synchronous_queue.rb:192:in `each'", "org/jruby/RubyHash.java:1342:in `each'", "/usr/shar
e/logstash/logstash-core/lib/logstash/util/wrapped_synchronous_queue.rb:191:in `each'", "/usr/share/logstash/logstash-
core/lib/logstash/pipeline.rb:294:in `filter_batch'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:282:
in `worker_loop'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:258:in `start_workers'"]}

```

We are upgrading from 2.4 to 5.1.2 and now we see that logstash fails.  
I guess it's a bug in mutate plugin.

---

<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:** [February 1, 2017, 8:36am UTC](https://discuss.elastic.co/t/convert-boolean-fails-on-trueclass/73480/2 "2017-02-01T08:36:16Z")

</div>

Yes, it's a bug (see below). But why are you attempting to convert a boolean into a boolean?

> <https://github.com/logstash-plugins/logstash-filter-mutate/issues/73>

---

<div class="post-metadata">

**Author:** ![stevie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevie/32/23394_2.png) [@stevie](https://discuss.elastic.co/u/stevie)\
**Post date:** [February 1, 2017, 8:38am UTC](https://discuss.elastic.co/t/convert-boolean-fails-on-trueclass/73480/3 "2017-02-01T08:38:14Z")

</div>

Because we don't know if it was successfully converted to a boolean before.  
It's like a safety net.

And it seems to work in logstash 2.4.x.

---

<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:** [March 1, 2017, 8:38am UTC](https://discuss.elastic.co/t/convert-boolean-fails-on-trueclass/73480/4 "2017-03-01T08:38:27Z")

</div>

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