I am trying to read a csv file with logstash .
Here is my config file:
input {
file{
path => ["/home/abhinavkumar.gurung/Applications/csv/devian/data/autos.csv"]
type => "cars"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
csv{
columns => ["dateCrawled","name","seller",
"offerType","price","abtest","vechicletype","yearOfRegistration","gearbox","powerPS","model","kilometer","monthOfRegistration","fuelType","brand","notRepairedDamage","dateCreated","nrOfPictures","postalCode","lastSeen"]
separator =>","
convert => {"price" => "integer"
"yearOfRegistration" => "integer"
"powerPS" => "integer"
"kilometer" => "integer"
"nrOfPictures" => "integer"
"postalCode" => "integer"
}
remove_field =>["message","dateCrawled","monthOfRegistration","dateCreated","lastSeen"]
skip_header =>"true"
}
}
output {
elasticsearch {
hosts => ["elasticsearch:9200"]
user => elastic
password => changeme
index => "cars"
}
stdout {
codec => rubydebug
}
}
My error:
`Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, => at line 24, column 8 (byte 696) after filter {\n csv{\n\tcolumns => [\"dateCrawled\",\"name\",\"seller\",\n\t\"offerType\",\"price\",\"abtest\",\"vechicletype\",\"yearOfRegistration\",\"gearbox\",\"powerPS\",\"model\",\"kilometer\",\"monthOfRegistration\",\"fuelType\",\"brand\",\"notRepairedDamage\",\"dateCreated\",\"nrOfPictures\",\"postalCode\",\"lastSeen\"]\n \tseparator =>\",\"\n\tconvert => {\"price\" => \"integer\"\n\t\t\t\t\t\t\t\"yearOfRegistration\" => \"integer\"\n\t\t\t\t\t\t\t\"powerPS\" => \"integer\"\n\t\t\t\t\t\t\t\"kilometer\" => \"integer\"\n\t\t\t\t\t\t\t\"nrOfPictures\" => \"integer\"\n\t\t\t\t\t\t\t\"postalCode\" => \"integer\"\n\t\n\n\t}\n\tmutate", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:41:in `compile_imperative'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:49:in `compile_graph'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:11:in `block in compile_sources'", "org/jruby/RubyArray.java:2577:in `map'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:10:in `compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:151:in `initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:23:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:36:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:325:in `block in converge_state'"]}`