2015-07-13 63 views
1

我刚开始使用Logstash。我已经可以使用内置插件(如ruby-debugcsv)来运行它。我正在尝试创建一个自定义插件,并在教程后面出现问题herelogstash示例插件不工作

我开始安装插件。我的插件是位于$ LS_HOME /插件/ logstash - 输出 - 例如,/所以,从$ LS_HOME,我跑

bin/plugin install plugins/logstash-output-example/logstash-output-example-0.1.3.gem 

这给了我这个输出

Validating plugins/logstash-output-example/logstash-output-example-0.1.3.gem 
Installing logstash-output-example 
Installation successful 

我是比较满意的。为了测试我跑

bin/logstash -e 'input { stdin {} } output { example{} }'; 

这给了我

The error reported is: 
Couldn't find any output plugin named 'example'. Are you sure this is correct? 
Trying to load the example output plugin resulted in this error: no such file to load -- logstash/outputs/example 

然后,我很伤心。我做错了什么?

仅供参考,这里的插件代码

# encoding: utf-8 
require "logstash/outputs/base" 
require "logstash/namespace" 

# An example output that does nothing. 
class LogStash::Outputs::Example < LogStash::Outputs::Base 
    config_name "example" 

    public 
    def register 
    end # def register 

    public 
    def receive(event) 
    return "Event received" 
    end # def event 
end # class LogStash::Outputs::Example 

回答

0

你应该在你的Gemfile看看,如果你的插件例子是有的,否则你的插件因此未安装正确!

+0

我检查并在底部看到了一个条目。它保存在vendor/local_gems/{some hash string}/logstash-filter-myfilter中。但是当我去那个目录时,那里什么也没有。相反,我的(虽然hacky)解决方案是手动将插件复制到Gemfile所指向的任何目录。这似乎工作。但我对正确的程序应该是什么感兴趣。 – Bob

+0

我有完全相同的问题。建造宝石有什么问题吗? – NestorDRod

+0

我尝试手动将gem复制到Bob的目录中,但是当我键入“插件列表”时列出了新插件,我还收到一条错误消息,内容为“致命的:不是git存储库(或任何父项目录):.git“ 现在,我正在使用rubygems的镜像存储库,因为我在独立系统中工作,无法访问外部网站。 – NestorDRod