-1

How can i read files in logstash line by line using codec? When i tried the below configuration but it is not working:

file {
path => "C:/DEV/Projects/data/*.csv"
start_position => "beginning"
codec => line {
     format => "%{[data]}"
}
  • Your question is bad and badly written. What's not working? What's happening (logs, traces, output...)? How the observed behavior is different from the expected behavior? If you want anyone to help, you'll have to provide more information. – baudsp Oct 19 '17 at 09:22
  • I'm pretty sure you don't need the line codec, but since you don't provide any information, I have no idea if that's the problem. – baudsp Oct 19 '17 at 09:24

1 Answers1

0

Example of configuration with elasticsearch in the output:

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"
}

For filter : https://www.elastic.co/guide/en/logstash/current/plugins-filters-csv.html

lotfi1991
  • 35
  • 5