Logstash remove_field not working in order to upload csv to elasticsearch

I'm using elasticsearch, kibana and logstash 6.0.1.

I wish to upload csv data to elasticsearch by logstash and removing fields (path, @timestamp, @version, host and message). I'm showing logstash.conf and emp.csv files below. The upload will work if I don't use the remove_field instruction but I need to. Furthermore, the index was not created.

logstash.conf:

input {

  file {
	  path => "e:\emp.csv"
	  start_position => "beginning"
  }
}
filter {
  csv {
	  separator => ","
	  columns => ["code","color"]
	  remove_field => ["path", "@timestamp", "@version", "host", "message"]
  }

  mutate {convert => ["code", "string"]}
  mutate {convert => ["color", "string"]}

}
output {
  elasticsearch {
	hosts => "http://localhost:9200"
	index => "emp5"
	user => "elastic"
	password => "password"
  }
  stdout {}
}

emp.csv:

1,blue
2,red

Just it case, I tried to add remove_field to mutate but I got same results.

What is missing in this case?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.