Hi, i have a logstash agent setup on a window box with below configuration.
input {
file {
type => "autolog"
path => "E:/elkcluster/log/.log"
}
file {
type => "testscv"
path => "e:/elkcluster/test/.*"
}
}
filter {
if( [type] == "testscv")
{
csv {
columns => [ "id", "name", "job", "location", "joindate", "dummy" ]
separator => ","
}
}
}
output {
redis { host => "xxx.xxx.xxx.xxx" data_type => "list" key => "logstash" }
}
here is the sample csv file, and it worked with all fields parsed nicely.
1,aaaa,eng,l2,Oct 11 2010,1
2,bbb,mgr,l5,Oct 28 2010,1
3,ccc,mgr,l2,Nov 12 2013,1
4,ddd,eng,l4,Nov 10 2014,1
5,eee,eng,l2,Nov 18 2010,1
6,fff,eng,l2,Dec 12 2009,1
then i wanted to set the timestamp to the joindate, i added in the date filter below, but i got exception in elasticsearch. what should be the correct date format in this case? thank you.
filter {
if( [type] == "testscv")
{
csv {
columns => [ "id", "name", "job", "location", "joindate", "dummy" ]
separator => ","
}
date {
match => [ "joindate", "MMM dd YYYY" ]
}
}
}
[2015-07-22 12:00:46,456][DEBUG][action.bulk ] [logstash-2009.12.11][2] failed to execute bulk item (index) index {[logstash-2009.12.11][testscv][AU6z67dysgFpH4c5oQD7], source[{"message":["6,fff,eng,l2,Dec 12 2009,1\r"],"@version":"1","@timestamp":"2009-12-11T16:00:00.000Z","host":"xxx","path":"e:/elkcluster/test/empdata9.csv","type":"testscv","id":"6","name":"fff","job":"eng","location":"l2","joindate":"Dec 12 2009","dummy":"1"}]}
org.elasticsearch.index.mapper.MapperParsingException: failed to parse [joindate]