logstash-plugins / logstash-codec-json

Apache License 2.0
23 stars 29 forks source link

custom jrjackson options #18

Closed luw2007 closed 8 years ago

luw2007 commented 8 years ago

when i use logstash-output-mongodb, I got a error.

“options”=>{“amount”=>#<BigDecimal:4e9c3448,’0.951E2’,3(4)>
...
“/logstash-2.1.0/vendor/bundle/jruby/1.9/gems/bson-3.2.6-java/lib/bson/hash.rb:43:in `to_bson’”

The cause of jrjackson deault options: use_bigdecimal is true. I hacked the json.rb like this

logstash-codec-json/lib/logstash/codecs/json.rb +42
-               decoded = LogStash::Json.load(data)
+               decoded = LogStash::Json.load(data, {:use_bigdecimal=>false})

So, Can I have some custom options of the jrjackson.

guyboertje commented 8 years ago

The correct fix would be to patch BigDecimal etc to have a to_bson method in the mongodb output. See: https://github.com/logstash-plugins/logstash-output-mongodb/issues/18