How to debug plugin installation


#1

I'm running Logstash 1.5.2 under RHEL 6.4. (I previously was running 1.4.x so this is an upgraded install)

I've developed an output plugin which I have been testing by modifying the LS Gemfile and adding a path entry to point to the dir of the plugin. Further, I have been running LS in debug mode during these tests. The plugin is working great so I've built the gem locally and installed via bin/plugin install and while it says it installed successfully, bin/plugin list does not list the plugin. Further, in vendor/local_gems I see a directory has been created which appears to be a hash of some sort, under which is a directory named after my plugin. This directory is empty.

"bin/plugin list" doesn't show the plugin, and uninstall confirms nothing was installed.

Do you have any hints on how to figure out where things are going wrong? I have the option of running the plugin without a building a gem, but starting LS as a service quits, reporting "Bundler::PathError:" that the path specified in the Gemfile doesn't exist. Is this to be expected? Again, I'd prefer to be able to install a gem locally. Fwiw, building the example output plugin (from the docs) fails as well. Finally, what is the correct way to ensure any installed or partially installed plugin has been completely removed? (beyond bin/plugin uninstall) Thanks for any advice.


(Mark Walkom) #2

The docs have some information on building various plugin types that may help - https://www.elastic.co/guide/en/logstash/current/index.html


#3

yep, thank you. I've used the docs to help me get as far as I have- which is that the plugin works, but I haven't been able to get a local gem install to work; only running from a dir pointed to in the LS Gemfile. If it would fail with an error, that would help. Instead it claims it was successful though it clearly wasn't.


Install plugin on machine without git
(Eric Deveaud) #4

I had similar problem once.

is your source code pluggin under git ?
as you say that you modified the LS gem plugin I suspect that iti s not.

if not gem build will create an empty data.tar.gz directory because of the following line in gemspec.

# Files
  s.files = `git ls-files`.split($\)

you can check the content of the generated gem by untaring it

pluggin install won't complain if data is empty and claim "installation succesfull"

either git init (best way) your source directory in order to get infomation from git ls-files, or edit the gemspecfile to get the accurate list of files to embed in the gem.


Logstash 1.5.3 gem plugins
Building a custom plugin
#5

Eric, that was exactly it. Thank you so much!


(Tobias Bradtke) #6

Maybe something like this could work for directories with and without git:

# Files
  s.files = `find . -type f -and -not -path "*/.git*" -printf "%P\n"`.split($\)

(system) #7