Objective: print log/event in a log file which are failed to index in Elasticsearch.
I am ingesting logs via SQS input and few messages are getting failed to index in Elasticsearch. I have debug logs and it shows the following error. I want to configure something like if a message gets failed to index then it should create a log file containing the message body and error message so I can go and keep track of failed messages.
[WARN ] 2021-02-11 12:06:00.675 [[main]>worker0] elasticsearch - Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"wallet-bitgo-tx-5e75adf5d133322f00fbd926a693b2ee-2021.02", :routing=>nil, :_type=>"_doc"}, #<LogStash::Event:0x80276f1>], :response=>{"index"=>{"_index"=>"wallet-bitgo-tx-5e75adf5d133322f00fbd926a693b2ee-2021.02", "_type"=>"_doc", "_id"=>"tYzNj3cBhtDPI8Cvu5gl", "status"=>400, "error"=>{"type"=>"illegal_argument_exception", "reason"=>"mapper [inputs.valueUnitAmount] cannot be changed from type [float] to [long]"}}}}