I have been struggling to get started creating a custom LogStash plugin inside an air gaped environment. Today I made an interesting discovery. I am able to get a custom plugin to install and run successfully even though there are errors when I run logstash-plugin install
:
bash-4.2# unzip -q ~/logstash-5.0.0.zip -d /opt
bash-4.2# cd /opt/logstash-5.0.0/
bash-4.2# bin/logstash-plugin generate --name test --type filter --path ~/logstash/plugins/
Creating ~/logstash/plugins/logstash-filter-test
create logstash-filter-test/DEVELOPER.md
create logstash-filter-test/CONTRIBUTORS
create logstash-filter-test/README.md
create logstash-filter-test/Rakefile
create logstash-filter-test/logstash-filter-test.gemspec
create logstash-filter-test/Gemfile
create logstash-filter-test/spec/filters/test_spec.rb
create logstash-filter-test/spec/spec_helper.rb
create logstash-filter-test/LICENSE
create logstash-filter-test/CHANGELOG.md
create logstash-filter-test/lib/logstash/filters/test.rb
bash-4.2# cd ~/logstash/plugins/logstash-filter-test/
bash-4.2# vim logstash-filter-test.gemspec
<edit summary, description, and homepage>
bash-4.2# gem build logstash-filter-test.gemspec
WARNING: open-ended dependency on logstash-devutils (>= 0, development) is not recommended
if logstash-devutils is semantically versioned, use:
add_development_dependency 'logstash-devutils', '~> 0'
WARNING: See http://guides.rubygems.org/specification-reference/ for help
Successfully built RubyGem
Name: logstash-filter-test
Version: 0.1.0
bash-4.2# /opt/logstash-5.0.0/bin/logstash-plugin install logstash-filter-test-0.1.0.gem
Validating logstash-filter-test-0.1.0.gem
Installing logstash-filter-test
Error Bundler::InstallError, retrying 1/10
An error occurred while installing logstash-core-event-java (5.0.0), and Bundler cannot continue.
Make sure that `gem install logstash-core-event-java -v '5.0.0'` succeeds before bundling.
<Ctrl-C>
bash-4.2# /opt/logstash-5.0.0/bin/logstash-plugin list
...
logstash-filter-test
...
bash-4.2# /opt/logstash-5.0.0/bin/logstash -e 'input { stdin {} } filter { test {} } output { stdout {} }'
Sending Logstash logs to /opt/logstash-5.0.0/logs which is now configured via log4j2.properties.
[2017-07-19T20:33:18,314][INFO ][logstash.filters.test ] Using version 0.1.x filter plugin 'test'. This plugin isn't well supported by the community and likely has no maintainer.
The stdin plugin is now waiting for input:
[2017-07-19T20:33:18,340][INFO ][logstash.pipeline ] Starting pipeline {"id"=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>500}
[2017-07-19T20:33:18,345][INFO ][logstash.pipeline ] Pipeline main started
[2017-07-19T20:33:18,423][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
hello
2017-07-20T01:33:23.443Z <hostname> Hello World!
My question is since I am getting the Bundler error when I run logstash-plugin install
should I consider this plugin to be broken, or can I proceed with fleshing out the custom plugin? Is the Bundler error considered normally behavior for a local plugin install? It doesn't seem to matter whether or not I run logstash-plugin install
with or without the --local or --no-verify flags, the plugin will still install and run.
My set up is:
- RHEL 7.3
- LogStash v5.0.0
- OpenJDK v1.8.0
- whichever versions of JRuby and Gems that come bundled with LogStash 5.0.0
(no connection to the internet)