when I use logstash to collect data from syslog to mongodb and filter is dissect or grok, logstash log show error and can't transfer data, below is error message:
[2018-03-12T02:16:59,739][WARN ][logstash.outputs.mongodb ] Failed to send event to MongoDB {:event=>#LogStash::Event:0x20e5e1a0, :exception=>#<NoMethodError: undefined method to_json' for nil:NilClass Did you mean? to_bson>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-mongodb-3.1.3/lib/logstash/outputs/mongodb.rb:81:in
receive'", "/usr/share/logstash/logstash-core/lib/logstash/outputs/base.rb:92:in block in multi_receive'", "org/jruby/RubyArray.java:1734:in
each'", "/usr/share/logstash/logstash-core/lib/logstash/outputs/base.rb:92:in multi_receive'", "/usr/share/logstash/logstash-core/lib/logstash/output_delegator_strategies/legacy.rb:22:in
multi_receive'", "/usr/share/logstash/logstash-core/lib/logstash/output_delegator.rb:49:in multi_receive'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:479:in
block in output_batch'", "org/jruby/RubyHash.java:1343:in each'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:478:in
output_batch'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:430:in worker_loop'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:385:in
block in start_workers'"]}
I am very confused and because I could successfully put data to mongodb before. Besides, I tested and stdout correct result with commenting output mongodb plugin. Who can help me and encountered similar problem? Thanks.