lib/logstash/outputs/mongo.rb in logstash-output-mongo-1.0.0 vs lib/logstash/outputs/mongo.rb in logstash-output-mongo-1.0.1
- old
+ new
@@ -51,11 +51,11 @@
begin
# Our timestamp object now has a to_bson method, using it here
# {}.merge(other) so we don't taint the event hash innards
document = {}.merge(event.to_hash)
- @logger.info("Type=[#{@type}] Collection=[#{@collection}] _id=[#{document["_id"]}]")
+ @logger.debug("Type=[#{@type}] Collection=[#{@collection}] _id=[#{document["_id"]}]")
case @type
when "upsert"
statement = buildStatement(document)
@@ -101,10 +101,13 @@
def buildStatement(document)
statement = {}
@attributes.each do |attr|
- statement[attr] = document[attr]
+ # filter attributes for not null validation
+ if document[attr] != nil
+ statement[attr] = document[attr]
+ end
end
return statement
end