# How to convert a boolean value to string when ingesting with Logstash

**URL:** https://discuss.elastic.co/t/how-to-convert-a-boolean-value-to-string-when-ingesting-with-logstash/150812
**Category:** Logstash
**Created:** [October 3, 2018, 4:14am UTC](https://discuss.elastic.co/t/how-to-convert-a-boolean-value-to-string-when-ingesting-with-logstash/150812 "2018-10-03T04:14:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rohini\_basu](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@rohini\_basu](https://discuss.elastic.co/u/rohini_basu)
#### Post date: [October 3, 2018, 4:14am UTC](https://discuss.elastic.co/t/how-to-convert-a-boolean-value-to-string-when-ingesting-with-logstash/150812/1 "2018-10-03T04:14:16Z")

</div>

Hi,

I have a CSV file that I am currently ingesting via Logstash. I have a column 'Status' with 0 and 1 value.

Currently I am ingesting this Status column as a boolean value and as a result of which I am getting True / False values.

I want to ingest the values as 'Pass' and 'Fail' (for 0 and 1 respectively). Is there any way in Logstash to do this?  
In Kibana, how can I show Pass / Fail labels instead of False / True?

---

<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 3, 2018, 6:13pm UTC](https://discuss.elastic.co/t/how-to-convert-a-boolean-value-to-string-when-ingesting-with-logstash/150812/2 "2018-10-03T18:13:51Z")

</div>

I don't believe there's anything built-in for this but you can always use a ruby filter.

---

<div class="post-metadata">

### Author: ![rohini\_basu](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@rohini\_basu](https://discuss.elastic.co/u/rohini_basu)
#### Post date: [October 10, 2018, 11:02am UTC](https://discuss.elastic.co/t/how-to-convert-a-boolean-value-to-string-when-ingesting-with-logstash/150812/3 "2018-10-10T11:02:51Z")

</div>

Thanks Magnus. It will be great if you can help me with a small code snippet?

---

<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 10, 2018, 7:33pm UTC](https://discuss.elastic.co/t/how-to-convert-a-boolean-value-to-string-when-ingesting-with-logstash/150812/4 "2018-10-10T19:33:24Z")

</div>

Untested:

```
event.set('fieldname', event.get('fieldname') ? 'pass' : 'fail')
```

---

<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: [November 7, 2018, 7:44pm UTC](https://discuss.elastic.co/t/how-to-convert-a-boolean-value-to-string-when-ingesting-with-logstash/150812/5 "2018-11-07T19:44:54Z")

</div>

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