Hi , I am stuck in parsing the date field in CSV and tried my best but no luck.
CSV contains 2 fields, Data and Responsetime (separated by comma) and I want to plot graph in KIBANA with x axis as Date and response as Y axis. I am able to load the data to elastic search through logstash but it is failing with Date parsing.
Sample format of CSV
2017-04-20 10:00:01.789,2
2017-04-20 10:00:03.061,2
2017-04-20 10:00:07.247,2
2017-04-20 10:00:07.471,2
Conf file for uploading, filtering and output
input {
file {
path => "/home/ubuntu/Logsheet3.csv"
type => "sportium"
start_position => "beginning"
}
}
filter {
csv {
columns => ["date","responsetime"]
separator => ","
}
date {
match => ["date","YYYY-MM-dd HH:mm:ss.SSS","ISO8601"]
target => "@timestamp"
}
mutate {
convert => [ "responsetime", "float" ]
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "sportiumcsv"
}
stdout { codec => rubydebug }
}
Jsonoutput in elasticsearch
{
"_index": "sportiumcsv",
"_type": "sportium",
"_id": "AVvYodnHbFL5xGFaJABg",
"_version": 1,
"_score": null,
"_source": {
"date": "2017-04-20 10:59:59.192,1",
"path": "/home/ubuntu/Logsheet3.csv",
"@timestamp": "2017-05-05T12:42:17.394Z",
"@version": "1",
"host": "ip-172-31-1-97",
"message": ""2017-04-20 10:59:59.192,1"\r",
"type": "sportium",
"tags": [
"_dateparsefailure"
]
},
"fields": {
"@timestamp": [
1493988137394
]
},
"sort": [
1493988137394
]
}