# How to convert "on"/"off" text into boolean with Logstash?

**URL:** <https://discuss.elastic.co/t/how-to-convert-on-off-text-into-boolean-with-logstash/139549>\
**Category:** Logstash\
**Created:** [July 11, 2018, 11:43am UTC](https://discuss.elastic.co/t/how-to-convert-on-off-text-into-boolean-with-logstash/139549 "2018-07-11T11:43:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![burnersk](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@burnersk](https://discuss.elastic.co/u/burnersk)\
**Post date:** [July 11, 2018, 11:43am UTC](https://discuss.elastic.co/t/how-to-convert-on-off-text-into-boolean-with-logstash/139549/1 "2018-07-11T11:43:13Z")

</div>

I have a field, that contains either "" (empty string) or "on".

I want to convert that field into an boolean, which treats "" (empty string) as _false_ and "on" as _true_.

As mentioned with the [documentation](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html), the mutate convert filter treats:

- "true", "t", "yes", "y", and "1" as _true_
- "false", "f", "no", "n", and "0" as _false_
- empty strings as _false_

Is there any way to configure mutate convert, that it also convert "on" into _true_? Maybe just for that particular mutate filter?

---

<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:** [August 8, 2018, 11:43am UTC](https://discuss.elastic.co/t/how-to-convert-on-off-text-into-boolean-with-logstash/139549/2 "2018-08-08T11:43:20Z")

</div>

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