How to dispose the field of date type importing data to es by logstash?


(shao) #1

I have a question look like the title, my data has a field of date type, and I need to let it be date type in es after imported it by logstash, so I use date method:

input {
  file {
    path => ["C:\Users\Desktop\test.csv"]
    start_position => "beginning"
  }
}
filter {
  csv {
    separator => ","
    columns => ["name","age","time"]
  }
  mutate {
    convert => {
      "age" => "integer"
    }      
  }
   date {
      match => ["time", "yyyy/MM/dd HH:mm:ss"]
    }
 }

output {
  elasticsearch {
        hosts => ["127.0.0.1:9200"]
        index => "test2"
		document_type => "test2"
  }
}

my data:

shao,1,2018/10/12 05:48:07
shao,2,2017/10/12 05:48:07
liu,3,2016/10/12 05:48:07

by this way, I can not solve my trouble!!!
help me please!!!


(system) #2

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