- refactor now that @timestamp is a Time object

This commit is contained in:
Jordan Sissel 2013-08-25 00:24:27 -07:00
parent 9b8162c204
commit 05ab32f47e

View file

@ -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)