my log (json) content is:
{"release_time": "1998-01-01", "home_url": "http://www.777.com/show_page/id_001.html", "isVip": "", "channel": "777"}
{"release_time": "2009", "home_url": "http://www.666.com/show_page/id_002.html", "isVip": true, "channel": "666"}
{"release_time": "", "home_url": "http://www.666.com/show_page/id_003.html", "isVip": "", "channel": "666"}
logstash config :
input{}
filter{
json{
source => "message"
}
mutate {
convert => { "[release_time]" => "string" }
convert => { "[isVip]" => "string" }
}
}
output {
elasticsearch {index => "test-%{+YYYY.MM.dd}"}
}
then logstash error logs is:
"reason"=>"failed to parse [release_time]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: \"\""
curl -XGET http://localhost:9200/test-2016.05.12
...
"release_time":{"type":"date","format":"strict_date_optional_time||epoch_millis"}