logstash 制表符分隔符不转义

logstash tab separator not escaping

我有制表符分隔的数据,我想将其输入 logstash。这是我的配置文件:

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

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

output {
    stdout {
        codec => rubydebug
    }
}

它只是查找所有 .csv 文件并使用制表符将它们分开。对于这样的输入:

col1    col2
data1    data2

logstash 输出是(对于两行):

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

显然它没有正确解析它。我看到前段时间有人提出这个问题 here 但是没有解决。有谁知道这个问题是否已经解决或者是否有另一种方法可以解决?谢谢!

不要使用“\t”作为分隔符,而是输入一个实际的制表符。 像这样:

filter {
   csv {
    separator => "  "
   }
}

https://www.elastic.co/guide/en/logstash/6.2/plugins-filters-csv.html#plugins-filters-csv-separator

Define the column separator value. If this is not specified, the default is a comma ,. If you want to define a tabulation as a separator, you need to set the value to the actual tab character and not \t.