Hi,
I am trying to import historical data into elastic and having issues getting the dates to be accepted so I can use them as @timestamp for histograms and the like.
First I am creating the index by doing a PUT request with
{
"mappings":{
"redacted":{
"_all":{"enabled":true},
"properties":{
"Apptimestamp":{"type": "date", "index": "not_analyzed"},
"AppUser%":{"type": "float", "index": "not_analyzed"},
"AppSys%":{"type": "float", "index": "not_analyzed"},
"AppWait%":{"type": "float", "index": "not_analyzed"},
"AppIdle%":{"type": "float", "index": "not_analyzed"},
"AppSteal%":{"type": "float", "index": "not_analyzed"},
"AppBusy":{"type": "float", "index": "not_analyzed"},
"AppCPUs":{"type": "integer", "index": "not_analyzed"}
}
}
}
}
Note: the reason I am creating the index first is to ensure that the fields are in the correct format, if I try using csv{convert =>{"name" => "float"}} in the logstash config it does not always work and then sets my floats to strings and I can't use the Min/max, Average, etc. visualisations on them.
I am then trying to push .csv format data that looks like this snippet
CPU Total ip-10-157-38-108,User%,Sys%,Wait%,Idle%,Steal%,Busy,CPUs
2016-08-03 21:33:20,0.3,1.5,2.4,95.8,0.0,,8
2016-08-03 21:33:25,0.1,0.4,0.0,99.5,0.0,,8
2016-08-03 21:33:30,0.2,0.0,0.0,99.8,0.0,,8
2016-08-03 21:33:35,0.0,0.0,0.0,100.0,0.0,,8
into that index using a logstash configuration that looks like
input {
stdin{}
}
filter {
csv{
columns => ["Apptimestamp","AppUser%","AppSys%","AppWait%","AppIdle%","AppSteal%","AppBusy","AppCPUs"]
convert => {"Apptimestamp" => "date"}
}
date{
match => ["Apptimestamp", "yyyy-MM-dd HH:mm:ss"]
}
}
output {
#stdout { codec => rubydebug }
elasticsearch {
hosts => "localhost:9200"
#port => "443" # set to 80 if you want to use HTTP and not HTTPS
ssl => "false" # set to false if you don't want to use SSL/HTTPS
index => "redacted"
manage_template => false
}
}
But when I run this from the command line I get the message
response=>{"create"=>{"_index"=>"redacted", "_t
ype"=>"logs", "_id"=>"AVZaQfKtXZI4D2I1N-uT", "status"=>400, "error"=>{"type"=>"m
apper_parsing_exception", "reason"=>"failed to parse [Apptimestamp]", "caused_by
"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: \"2016-08-0
3 21:54:01\" is malformed at \" 21:54:01\""}}}}, :level=>:warn}←[0m
Pipeline main has been shutdown
Can anyone spot what I'm doing wrong or what config options I've missed? AM I just taking entirely the wrong approach?