无法将logstash与mongodb集成

时间:2015-06-04 12:13:12

标签: mongodb logstash

我想将logstash的输出发送到mongodb,我在linux中使用logstash的mongodb输出插件。我使用的是logstash-1.5.0.beta1和mongodb-3.0.3版本。我收到以下错误:

LoadError: no such file to load -- mongo
        require at org/jruby/RubyKernel.java:1065
        require at /root/logstash-1.5.0.beta1/vendor/jruby/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
        require at /root/logstash-1.5.0.beta1/vendor/jruby/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
        require at /root/logstash-1.5.0.beta1/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65
       register at /root/logstash-1.5.0.beta1/lib/logstash/outputs/mongodb.rb:37
           each at org/jruby/RubyArray.java:1613
  start_outputs at /root/logstash-1.5.0.beta1/lib/logstash/pipeline.rb:158
            run at /root/logstash-1.5.0.beta1/lib/logstash/pipeline.rb:79
        execute at /root/logstash-1.5.0.beta1/lib/logstash/agent.rb:141
            run at /root/logstash-1.5.0.beta1/lib/logstash/runner.rb:166
           call at org/jruby/RubyProc.java:271
            run at /root/logstash-1.5.0.beta1/lib/logstash/runner.rb:171
           call at org/jruby/RubyProc.java:271
     initialize at /root/logstash-1.5.0.beta1/vendor/bundle/jruby/1.9/gems/stud-0.0.18/lib/stud/task.rb:12

我的logstash配置文件如下:

input {
        file{
                path => "/something.csv"
                start_position => "beginning"
                sincedb_path => "/dev/null"
                }
}

output { stdout {codec => rubydebug}
        mongodb{
                collection => "users"
                database => "test"
                uri => "mongodb://localhost:27017/"
        }
}

我使用以下命令运行:

/root/logstash-1.5.0.beta1/bin/logstash -f /etc/logstash/logstash-mongodb.conf

有人可以指导我解决方案吗?

1 个答案:

答案 0 :(得分:0)

由于您将文件名称为 - path => “/something.csv” - logstash无法识别。添加文件输入路径的绝对路径,如下所示,以便logstash可以识别位置并对其进行处理。

input {
        file {
                path => "C://myfile/something.csv"
                start_position => "beginning"
                sincedb_path => "/dev/null"
        }
}