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


(Rohini Basu) #1

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?


(Magnus Bäck) #2

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


(Rohini Basu) #3

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


(Magnus Bäck) #4

Untested:

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

(system) #5

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