phutchins/logstash-input-mongodb

Handle boolean fields

lorecoro opened this issue · 1 comments

At the moment boolean fields in mongo are discarded and don't reach the filter phase.

Solution:

diff --git a/lib/logstash/inputs/mongodb.rb b/lib/logstash/inputs/mongodb.rb
index 16b85ab..a1b021d 100644
--- a/lib/logstash/inputs/mongodb.rb
+++ b/lib/logstash/inputs/mongodb.rb
@@ -302,6 +302,8 @@ class LogStash::Inputs::MongoDB < LogStash::Inputs::Base
                   else
                     event.set(k.to_s, v)
                   end
+                elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
+                  event.set(k.to_s,v.to_s)
                 else
                   if k.to_s  == "_id" || k.to_s == "tags"
                     event.set(k.to_s, v.to_s )