# Logstash + Elasticsearch Boolean data 질문입니다

**URL:** <https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064>\
**Category:** Logstash\
**Created:** [June 24, 2019, 7:10am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064 "2019-06-24T07:10:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgw5540](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@pgw5540](https://discuss.elastic.co/u/pgw5540)\
**Post date:** [June 24, 2019, 7:10am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064/1 "2019-06-24T07:10:59Z")

</div>

Logstash로 csv 데이터를 입력하는 과정에서, 1,0 으로 들어오는 데이터를 boolean으로 Convert하여 입력할 때 에러가 발생합니다. Failed to convert [Field name] into boolean  
해당 에러가 왜 발생하는지 알 수 있을까요?

---

<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:** [June 24, 2019, 11:59am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064/2 "2019-06-24T11:59:15Z")

</div>

The csv [code](https://github.com/logstash-plugins/logstash-filter-csv/blob/9e10255b5ca847a7927d2c5c9ec4ce9c57acaeea/lib/logstash/filters/csv.rb#L95) only supports conversion of the strings "true" and "false". Use [mutate+convert](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-convert).

---

<div class="post-metadata">

**Author:** ![pgw5540](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@pgw5540](https://discuss.elastic.co/u/pgw5540)\
**Post date:** [June 25, 2019, 8:54am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064/3 "2019-06-25T08:54:37Z")

</div>

The same error occurs when converting the strings "true" and "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:** [June 25, 2019, 2:35pm UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064/4 "2019-06-25T14:35:57Z")

</div>

Not for me.

```
input { generator { count => 1 lines => ['foo,true,false'] } }
filter { csv { convert => { "column2" => "boolean" "column3" => "boolean" } } }
output { stdout { codec => rubydebug { metadata => false } } }

```

produces booleans in the output.

---

<div class="post-metadata">

**Author:** ![pgw5540](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@pgw5540](https://discuss.elastic.co/u/pgw5540)\
**Post date:** [June 26, 2019, 12:46am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064/5 "2019-06-26T00:46:08Z")

</div>

I added filter {csv {convert =\> {"column1" =\> "boolean"}} to the Logstash config file.  
However, the Warnning message still appears in the Logstash log.

[2019-06-26T09:38:31,852][WARN][logstash.filters.mutate] Failed to convert column1 into boolean.

---

<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:** [June 26, 2019, 1:55am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064/6 "2019-06-26T01:55:07Z")

</div>

If you are referring to my example, "foo" is not a valid boolean. If you are not, please post a simple reproducible example of the problem.

---

<div class="post-metadata">

**Author:** ![pgw5540](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@pgw5540](https://discuss.elastic.co/u/pgw5540)\
**Post date:** [June 26, 2019, 2:19am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064/7 "2019-06-26T02:19:22Z")

</div>

Thank you for your help. It was an error caused by reading the header of the csv file. Therefore, we solved it by using skip\_header option. Thank you for your consideration.

---

<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 24, 2019, 2:30am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-boolean-data/187064/8 "2019-07-24T02:30:11Z")

</div>

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