Mutate type as boolean.

Description

Hello ,

I have a column with string value as True or False . While inserting it into elasticsearch i want to convert this column with type as boolean and dump data . so i tried doing this by mutate convert function . it works for integer and float . how can i do this for boolean.

below is my filter.

filter {

if [type] == "rawdata"
{
csv {
separator => ','
quote_char => '|' # arbitrary, default one is included in the data and does not work
columns => [ 'datetime1','GPSAvaliable','SOSType' ]

}

mutate
{

convert => ["GPSAvaliable","boolean"] #getting error for this
convert => ["SOSType","boolean"] #getting error for this
convert => ["PORT","integer"]
convert => ["Speed","float"]
}

}

  1. }
    }

Activity

Show:
Philippe Weber
May 28, 2014, 11:57 AM

The conversion to boolean is not available inside logstash.
As the string are already true/false, normally updating your Elasticsearch template mapping upfront should be enough for elasticsearch to understand your fields as boolean,
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#boolean

Maybe keeping the mutate filter to do a lower case conversion will be necessary

Assignee

Philippe Weber

Reporter

k

Labels

Affects versions

Configure