logstash tab separator not escaping

Noah Santacruz picture Noah Santacruz · Jun 18, 2015 · Viewed 13.1k times · Source

I have tab separated data which I want to input into logstash. Here is my configuration file:

input {
    file {
        path => "/*.csv"
        type => "testSet"
        start_position => "beginning"
    }
}

filter {
    csv {
        separator => "\t"
    }
}

output {
    stdout {
        codec => rubydebug
    }
}

It simply looks for all .csv files and separates them using tabs. For an input like this:

col1    col2
data1    data2

logstash output is (for the two rows):

column1 => "col1\tcol2"
column1 => "data1\tdata2"

Obviously it is not correctly parsing it. I saw that this issue was brought up a while ago here but there was no solution. Does anyone know if this problem has been resolved or maybe there's another way to do it? Thanks!

Answer

Roman picture Roman · Jun 18, 2015

Instead of using "\t" as the seperator, input an actual tab. like this:

filter {
   csv {
    separator => "  "
   }
}