Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle boolean fields #85

Open
lorecoro opened this issue Dec 13, 2017 · 1 comment
Open

Handle boolean fields #85

lorecoro opened this issue Dec 13, 2017 · 1 comment

Comments

@lorecoro
Copy link

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

@lorecoro
Copy link
Author

lorecoro commented Dec 13, 2017

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 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant