I would really appreciate some input regarding how to install locally manufactured plugins. There seems to be a bit of a black hole in this area where Logstash (testing with 2.2) is telling me that the plugin installed okay, but:
- Does not show up with "plugin list".
- Referencing the plugin in a Logstash conf file results in a Couldn't find any filter plugin named 'mypluginname' error.
The procedure I have used is this:
I made a local file structure as described here: https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html
Looks like this (in a folder on my C:\ called "git" - but not linked to any repository, its just the folder name for testing)
logstash-filter-mypluginname
├── Gemfile
├── LICENSE
├── README.md
├── Rakefile
├── lib
│ └── logstash
│ └── filters
│ └── mypluginname.rb
├── logstash-filter-mypluginname.gemspec
└── spec
└── filters
└── mypluginname_spec.rb
The Gemfile contains a single line:
gem "logstash-filter-mypluginname", path => "C:/git/logstash-filter-mypluginname"
The gemspec file file contains:
Gem::Specification.new do |s|
s.name = 'logstash-filter-mypluginname'
s.version = '0.1.0'
s.licenses = ['Apache License (2.0)']
s.summary = "This is the description of the plugin."
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
s.authors = ["Anon"]
s.email = 'info@elastic.co'
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
s.require_paths = ["lib"]
# Files
s.files = Dir['lib/logstash/filters/*.rb'] + Dir['spec/*']
# Tests
s.test_files = s.files.grep(%r{^(test|spec|features)/})
# Special flag to let us know this is actually a logstash plugin
#s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
# Gem dependencies
s.add_runtime_dependency 'logstash-core', '>= 1.4.0', '< 2.0.0'
s.add_development_dependency 'logstash-devutils'
end
With all that in place I was able to make a new .gem which was installable using the --no-verify parameter.
This returned a success message.
However:
The plugin does not show in a plugin list and it looks as though Logstash cannot find it when it appears in a .conf file as mentioned at the beginning.
I see in the Logstash directory it has created a new entry under local gems where my structure and the .rb file are definitely there.
Can someone please shed some light on this? Its an absolute game changer if we cannot reliably install local plugins.
Thanks.