lusis / chef-logstash

Semi-official Logstash cookbook
Other
271 stars 353 forks source link

logstash not installed (Checked on Vagrant with Berkshelf) #433

Closed sagar1730 closed 8 years ago

sagar1730 commented 8 years ago

I have tested this cookbook on Vagrant with Chef-solo provisioner, but unfortunately I can't see any logstash directory in /bin/logstash neither in /opt/logstash. Am I missing something??

I am new to this, your help will be highly appreciated.

davidski commented 8 years ago

Please post your recipe (if using the LWRP) or your Vagrantfile (if just using the supplied recipes) along with the output of your chef run so that we can debug.

sagar1730 commented 8 years ago

This is my Vagrantfile.

Vagrant.configure(2) do |config| config.berkshelf.berksfile_path = "cookbooks/logstash/Berksfile" config.berkshelf.enabled = true config.vm.box = 'bento/ubuntu-14.04' config.vm.provision "chef_solo" do |chef| chef.cookbooks_path = "cookbooks" chef.add_recipe "logstash" end end

davidski commented 8 years ago

That will invoke the logstash::default recipe, which is a stub (no-op) recipe. You would need to at least use the logstash::server recipe, but note that using the supplied server and agent recipes is no longer recommended and, instead, the use of the resource oriented module is suggested.

If you're not familiar with resource based cookbooks, they provide a series of language extensions to the core Chef DSL to allow you work with (in this case) logstash specific bits. As an example, you're welcome to take a look at our cookbook which uses this approach at https://github.com/SCH-CISM/sch-logstash -- though I don't claim it's a great work of art. :smile:

Resource cookbooks are incredibly powerful, but they are a bit more work to use. If you just want to kick the tires on the logstash cookbook, you'll probably get further faster using test-kitchen. A simple kitchen converge ubuntu-14 in this cookbook's directory should spin up a functioning logstash instance.

Hope this helps!

sagar1730 commented 8 years ago

Thanks David for the awesome and quick assistance.I did mentioned changes in Vagrantfile and it works partially, the service is started now but at the time of vagrant provision it is showing the following error.

'Error executing action run on resource 'execute[bin/plugin install logstash-output-influxdb]'

'Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.'

logstash

I am new to kitchen so will try it later.

sagar1730 commented 8 years ago

Java is not installed, though I have mentioned it in Berksfile. Also I can't find /bin/plugin directory.

sagar1730 commented 8 years ago

Hi David, It was because I haven't added source.rb in Vagrantfile, I have added it now, but even through I am facing new problem (shown in picture), I hope you have solution for this as well.

updated

davidski commented 8 years ago

You've got at least two problems going on here: 1) You don't have java installed. Putting java into your Berksfile pulls down the cookbook, but doesn't execute it. You need something like java::default in your runlist to actually execute the recipe. Note that the Java cookbook requires other attributes to pull down the Oracle v7 JRE (both JRE7 and JRE8 should work). 2) You're running the logstash::source recipe, which is deprecated per https://github.com/lusis/chef-logstash#source (the docs could stand to be clearer on this point :grin:)

You really should be using logstash::server or, if you have a particular use case, the logstash::agentrecipe. Even if you're not using test-kitchen, please look at .kitchen.yml for sample attributes on how a minimal logstash instance can be set up. That, or look at my cookbook which I pointed you to earlier for a more complete example.

sagar1730 commented 8 years ago

Thanks again David to come to my rescue. Its working perfectly now. Initially I mentioned java::default in runlist just below logstash::server, that's why it was troubling me. I change the sequence (reverse) and then it does its magic. I will look to the complex cookbook soon.

davidski commented 8 years ago

My pleasure @sagar1730. FYI - runlists (and resources in the compiled chef recipes) are order dependent. The java::default recipe has to be called before the logstash recipe in order for java to be available when chef tries to install logstash. Give some of the materials out at https://learn.chef.io/ a try to help clear up any lingering confusion. If you're done with this issue, please close it out so that it doesn't show up as an open item for the dev team. :grin:

Best of luck!