Elasticsearch with Logstash & Kibana using Vagrant & Virtualbox on Ubuntu 14.04

I have been working on a project where I need to send logs from Python logger to logstash so I can visualize the logs later using Kibana. Instead of setting up elasticsearch with logstash and kibana on my local workstation, I decided to setup a virtual machine running the complete stack. I have been using Virtualbox on my Ubuntu workstation and pretty happy with it. To make life easier, I put together a vagrant script to spin off VM running the elasticsearch stack so that I can share it work other developers working on the same project.

Below instructions assume that you are running Ubuntu with Virtualbox already installed but I think these instructions can work any other Linux distribution as well.

    1. Download and install virtualbox. If you are using Ubuntu, you can just use Ubuntu Software Center or apt-get command to install the virtualbox. However, you might have to download and install the virtualbox extension pack manually. After installing the virutalbox, I also created a Host Only network with subnet 172.28.128.0/24.
    2. Download and install vagrant. You can download the debian package from https://www.vagrantup.com/downloads. Use dpkg or Ubuntu Software Center to install the package.
    3. Create vgfiles directory in your home directory.
    4. Create Vagrant initialization file Vagrantfile under vgfiles directory and add following contents to this file.
    5. Create bootstrap.sh file with following contents under vgfiles directory  and add following contents to this file.
    6. Change your current directory to vgfiles.
    7. Run vagrant command to build the virtual machine.

      Based on your Internet connection speed, it came take few minutes to build the virtual machine.
    8. Once the virtual machine build process is completed, ssh to this machine using port 2222.

      Use password vagrant when prompted.
    9. Use ifconfig command to find the second NIC ip address.
    10. You can use following URLs to use elasticsearch
      Elasticsearch – http://localhost:9200/_plugin/head/
      Kibana – http://<IP address>/

 

5 thoughts on “Elasticsearch with Logstash & Kibana using Vagrant & Virtualbox on Ubuntu 14.04”

  1. Your examples seem to have lost something in translation. I think there are a few newlines that were eaten, so when I copy the code into a vagrant file, I get some errors. An example:

    # config.ssh.forward_agent = true config.vm.provider “virtualbox” do |vb|

    All appears on a single line, when it should be on two lines like:
    # config.ssh.forward_agent = true

    config.vm.provider “virtualbox” do |vb|

    Thanks for the post though, it’s a good start!

Leave a Reply

Your email address will not be published. Required fields are marked *


*