Logstash S3输入NoMethodError

时间:2014-12-09 06:01:35

标签: ruby amazon-web-services amazon-s3 logstash

我是logstash的新手,无法让s3输入正常工作。正如您在下面看到的,我一直遇到这个Error: undefined method common_prefixes for {}:Hash问题,我不知道为什么。

我正在使用网站上最新的Logstash 1.4.2。我下载,解压,运行下面的配置并得到下面列出的错误。

我错过了依赖吗?看起来Logstash捆绑了我应该需要的一切,包括aws-sdk。

我的配置如下所示:

input {
  s3 {
    bucket => "mybucket/withadirectory/"
    credentials => ["id", "key" ]
    codec => "json"
  }
}

output {
  stdout { codec => rubydebug }
}

广告内容

s3cmd ls s3://mybucket/withdirectory/
2014-11-24 21:43         0   s3://mybucket/withdirectory/
2014-12-08 07:45    729126   s3://mybucket/withdirectory/SampleFileForTesting.gz

错误

Pipeline started {:level=>:info, :file=>"logstash/pipeline.rb", :line=>"78"}
A plugin had an unrecoverable error. Will restart this plugin.
Plugin: <LogStash::Inputs::S3 bucket=>"mybucket/withdirectory/", credentials=>["xyz", "zyx"], region_endpoint=>"us-west-2">
  Error: undefined method `common_prefixes' for {}:Hash
  Exception: NoMethodError
  Stack: /home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/core/data.rb:101:in `method_missing'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/core/data.rb:121:in `method_missing'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/core/response.rb:184:in `method_missing'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/s3/prefix_and_delimiter_collection.rb:31:in `each_member_in_page'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/s3/object_collection.rb:288:in `each_member_in_page'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/s3/paginated_collection.rb:31:in `_each_item'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/core/collection/with_limit_and_next_token.rb:54:in `_each_batch'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/core/collection.rb:80:in `each_batch'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/core/collection.rb:47:in `each'
/home/test/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/aws-sdk-1.35.0/lib/aws/s3/object_collection.rb:282:in `each'
/home/test/logstash-1.4.2/lib/logstash/inputs/s3.rb:168:in `list_new'
/home/test/logstash-1.4.2/lib/logstash/inputs/s3.rb:150:in `process_new'
/home/test/logstash-1.4.2/lib/logstash/inputs/s3.rb:137:in `run'
org/jruby/RubyKernel.java:1521:in `loop'
/home/test/logstash-1.4.2/lib/logstash/inputs/s3.rb:136:in `run'
/home/test/logstash-1.4.2/lib/logstash/pipeline.rb:163:in `inputworker'
/home/test/logstash-1.4.2/lib/logstash/pipeline.rb:157:in `start_input' {:level=>:error, :file=>"logstash/pipeline.rb", :line=>"168"}

1 个答案:

答案 0 :(得分:1)

我在输出插件中有类似的问题,json格式的s3插件中存在一个错误。 https://logstash.jira.com/browse/LOGSTASH-1643

我改为1.5.0,一切正常。 不确定输入插件是否存在相同的问题,您可以将编解码器更改为plain或切换到1.5.0以尝试。

祝你好运〜