简体   繁体   English

Logstash插件开发

[英]Logstash plugin development

I'm trying to develop an input plugin for logstash. 我正在尝试为Logstash开发输入插件。

i've used this tutorial 我用过本教程

http://blog.eagerelk.com/how-to-write-a-logstash-plugin/ http://blog.eagerelk.com/how-to-write-a-logstash-plugin/

the problem that i've had when i tried to install "bundle" using "bundle install" 我尝试使用“捆绑安装”安装“捆绑”时遇到的问题

- this is the error message -这是错误消息

Your Ruby engine is ruby, but your Gemfile specified jruby 您的Ruby引擎是ruby,但是您的Gemfile指定了jruby

- Gemfile: -宝石文件:

source ' https://rubygems.org ' ruby '2.2.0', :engine => 'jruby', :engine_version => '2.3.1' gemspec 来源' https ://rubygems.org'ruby'2.2.0',:engine =>'jruby',:engine_version =>'2.3.1'gemspec

- ruby -v : -红宝石-v:

ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin16] 红宝石2.2.0p0(2014-12-25修订版49005)[x86_64-darwin16]

- jruby -v : -jruby -v:

jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [darwin-x86_64] jruby 9.1.8.0(2.3.1)2017-03-06 90fc7ab Java HotSpot(TM)64位服务器VM 1.8.0_92-b14 + jit上的25.92-b14 [darwin-x86_64]

What am I doing wrong here? 我在这里做错了什么?

Since you are using rbenv , here are some good troubleshooting steps: 由于您正在使用rbenv ,因此这里有一些很好的故障排除步骤:

  • Ensure that your PATH contains /path/to/your/home/directory/.rbenv/shims or some similar variant. 确保您的PATH包含/path/to/your/home/directory/.rbenv/shims或某些类似的变体。
  • You also need eval "$(rbenv init -)" in your shell's .bash|zsh|whateverrc file. 您还需要在Shell的.bash|zsh|whateverrc文件中使用eval "$(rbenv init -)"
  • If this is all in order, then check the .ruby-version file. 如果一切正常,请检查.ruby-version文件。 Change to the directory of the project you're working on and invoke cat .ruby-version . 转到您正在处理的项目的目录,然后调用cat .ruby-version
    • If not, just make a new file with this name and place an appropriate JRuby version string in it. 如果不是,只需使用此名称创建一个新文件,然后在其中放入适当的JRuby版本字符串。 A good way to check available versions is rbenv install --list , but the latest (from my local ruby-build ) is jruby-9.1.7.0 检查可用版本的好方法是rbenv install --list ,但是最新的(来自我本地的ruby-build )是jruby-9.1.7.0
  • Now invoke rbenv install . 现在调用rbenv install If you don't wish to make the file / want to skip this step just run rbenv install jruby-9.1.7.0 如果您不想创建文件/不想跳过此步骤,只需运行rbenv install jruby-9.1.7.0
  • rbenv rehash; bundle rbenv rehash; bundle should now work. rbenv rehash; bundle现在应该可以工作了。

Looks like your bundler is trying to use the system's default Ruby version instead of use the JRuby. 看来您的捆绑软件正在尝试使用系统的默认Ruby版本而不是JRuby。

I recommend to you uninstall all previous installations of Ruby to make your system clean again. 我建议您卸载所有先前安装的Ruby,以再次使系统干净。

After that, make sure your PATH is correct. 之后,请确保您的PATH是正确的。
If you're using bash, your ~/.bashrc or ~/.bash_profile should have the following commands: 如果您使用的是bash,则~/.bashrc~/.bash_profile应该具有以下命令:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

If you're using zsh, these commands must resides in ~/.zshrc . 如果您使用的是zsh,则这些命令必须位于~/.zshrc

After that, enter your project directory and creates a new file .ruby-version : 之后,进入您的项目目录并创建一个新文件.ruby-version

echo 'jruby-9.1.7.0' > .ruby-version

Note: you can see other versions available using the command rbenv install --list . 注意:您可以使用命令rbenv install --list查看其他可用版本。

Lastly, leaves the directory, enter it again, and run the following commands: 最后,离开目录,再次输入目录,然后运行以下命令:

rbenv install jruby-9.1.7.0
gem install bundler # to install the bundler gem in the context of your new JRuby 9.1.7.0
bundle install      # to install the gems listed in your Gemfile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM