diff --git a/lib/logstash/outputs/mongodb.rb b/lib/logstash/outputs/mongodb.rb index a2f6e6f8d..4c68ad359 100644 --- a/lib/logstash/outputs/mongodb.rb +++ b/lib/logstash/outputs/mongodb.rb @@ -52,9 +52,9 @@ class LogStash::Outputs::Mongodb < LogStash::Outputs::Base if @isodate # the mongodb driver wants time values as a ruby Time object. # set the @timestamp value of the document to a ruby Time object, then. - document = event.to_hash.merge("@timestamp" => event.ruby_timestamp) - else document = event.to_hash + else + document = event.to_hash.merge("@timestamp" => event["@timestamp"].to_json) end if @generateId document['_id'] = BSON::ObjectId.new(nil, event.ruby_timestamp)