-1

如何使用编解码器逐行读取logstash中的文件?当我尝试以下配置但它不起作用时:

file {
path => "C:/DEV/Projects/data/*.csv"
start_position => "beginning"
codec => line {
     format => "%{[data]}"
}
4

1 回答 1

0

输出中使用 elasticsearch 的配置示例:

input{
    file {
        path => "C:/DEV/Projects/data/*.csv"
        start_position => beginning
    }

}

filter {

csv {

    columns => [
        "COLUMN_1",
        "COLUMN_2",
        "COLUMN_3",
         .
         .
        "COLUMN_N"
    ]
    separator => ","
}

mutate {
        convert => { 
            "COLUMN_1" => "float" 
            "COLUMN_4" => "float" 
            "COLUMN_6" => "float" 
        }
}
}

output {
elasticsearch {

    hosts => ["localhost:9200"]
    action => "index"
    index => "test_index"
}

对于过滤器: https ://www.elastic.co/guide/en/logstash/current/plugins-filters-csv.html

于 2017-10-20T14:25:19.223 回答