Date parsing:
date
{
match => [ "logtime" ,"yyyy-MM-dd HH-mm-ss"]
timezone => UTC
target => "logtime"
}
Template mapping:
"logtime": {"type": "date", "format" : "yyyy-MM-dd HH-mm-ss"}
Error while sending to elastic:
[2019-11-25T01:23:07,800][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"lsh-new-tempindexfor8650sdm_v4-2019.11.25", :_type=>"sdmmapping", :_routing=>nil}, #LogStash::Event:0x5e4e0083], :response=>{"index"=>{"_index"=>"lsh-new-tempindexfor8650sdm_v4-2019.11.25", "_type"=>"sdmmapping", "_id"=>"z99xoW4BoNYXwHJfTgZZ", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [logtime] of type [date] in document with id 'z99xoW4BoNYXwHJfTgZZ'", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: "2019-11-20 17:31:46" is malformed at "-11-20 17:31:46""}}}}}
A quick help reply on this will be great help for me please
You have used a date filter to convert [logtime] to a LogStash::Timestamp. I don't think you need a template for the field once you have done that. elasticsearch will by default convert it to a date.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.