Hello,
can anyone help me to map the date, 2018-12-03 06:00:00.000
I have tried to give mapping to load into logstash as
yyyy-MM-dd HH:mm:ss.SSS
but getting below error
"error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [updated_date]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: "2018-11-21T18:30:00.000Z" is malformed at "T18:30:00.000Z""}
For non-formatting syntax, you’ll need to put single-quote characters around the value. For example, if you were parsing ISO8601 time, "2015-01-01T01:12:23" that little "T" isn’t a valid time format, and you want to say "literally, a T", your format would be this: "yyyy-MM-dd’T'HH:mm:ss"
So, the format should be: yyyy-MM-dd'T'HH:mm:ss.SSS.
If this didn't help, I need to see the input data, Logstash config and the error message you received.
Hello, thanks for reply
the above format didnt work for me.
The sample date format present in database for column updated_date is as shown
2017-12-18 00:00:00.000
Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"idx_sqldata", :_type=>"_doc", :_routing=>nil}, #LogStash::Event:0x613cc85f], :response=>{"index"=>{"_index"=>"idx_sqldata", "_type"=>"_doc", "_id"=>"bcDpnGcBu0SneeiwZGsB", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [updated_date]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: "2018-11-21T18:30:00.000Z" is malformed at "Z""}}}}}
As the log states, it is a mapping problem with Elasticsearch. What kind of mapping are you using for the idx_sqldata index?
This means that the updated_date field has been mapped to a different format than the one you are trying to pass to it.
Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"idx_sqldata", :_type=>"_doc", :_routing=>nil}, #LogStash::Event:0x613cc85f], :response=>{"index"=>{"_index"=>"idx_sqldata", "_type"=>"_doc", "_id"=>"bcDpnGcBu0SneeiwZGsB", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [updated_date]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: "2018-11-21T18:30:00.000Z" is malformed at "Z""}}}}}
But what I need to see is the event what you are trying to insert into Elasticsearch. You already have the config there in the output section, stdout with rubydebug.
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.