How to install Logstash on Windows Server 2012 with Kibana in IIS.

This post is currently outdated, please have a look here to see a up to date version:
This guide will be updated as soon as possible.

In this guide I will show that it is also possible to run Logstash on a Windows Server 2012 machine and use IIS as web server. This guide probably requires some improvements and optimizations but it should give you a good example of how to set everything up.

Please, be aware that you will probably have to configure Kibana in a different way then I did to make everything look shiny, and you will probably have to use a different kind of logstash configuration to make things show as you would like. I am also aware that Logstash provides all-in-one pages that have ElasticSearch and Kibana built in, however I still feel setting things up separately is more appropriate.

The config below is just meant to be an example to show that everything works just as fine on Windows as it does on Linux.

If you are interested in Linux then please have a look at my other guide at:

Now lets start with the guide!

Step 1: Download Logstash, Kibana and ElasticSearch.
Simpely go to “


Step 2: Extract all packages
I created myself a folder called “basefarm” in “c:\basefarm\” and extracted all folders there to make it easier.

So, for me it looks like this now:

Step 3: Download the JDK version of Java and install it.
Go to the Java website:
Accept the license and then download: “Windows x64 (jdk-8u5-windows-x64.exe)” package.
Now install it!

Step 4: Add the JAVA_HOME variable to the server
Now right click on “This PC” and choose “Properties” on the right bottom site next to your computer and full computer name click on Change settings.
On the window that opens go to the Advanced tab and click on “Environment Variables”.
at the bottom box called “System Variables” click on “new” and add the following:
Variable Name: JAVA_HOME
Variable value: C:\Program Files\Java\jdk1.8.0_05

It should look like this:

Step 5: Download the required configuration files

Place this file in:


Place this file in:

rename “ulyaoth.json” to “basefarm.json” so you end up with “C:\basefarm\kibana\app\dashboards\basefarm.json”.

Step 6: Configure Kibana & Logstash
Open the file: C:\basefarm\kibana\config.js

and change the following line:
default_route : ‘/dashboard/file/default.json’,

default_route : ‘/dashboard/file/basefarm.json’,

Now open the file: C:\basefarm\kibana\app\dashboards\basefarm.json

and change the following line:
“title”: “Ulyaoth: Logstash Search”,

“title”: “Basefarm: Logstash Search”,

Step 7: Install IIS
Go to “Server Manager” and choose “Add Roles and Features Wizard” from the list here choose “Web Server (IIS)” now go further and let it install.

Step 8: Open IIS Manager and stop the “Default Web Site”
Just press the stop button like you see below in the picture:

Step 9: Create a new website for Kibana as shown below
Right click on “sites” in the left part of IIS Manager and click “Add Website”.

Fill it in something like this:

It should automatically start.

Step 10: Start Elasticsearch and put it on auto-start
Open a console and go to “c:\basefarm\elasticsearch\bin\”
now type the following command:
service install

You should see something like:

Now type the following:
service manager

You should see the elasticsearch service manager:

You have to change on the tab the “Startup type” from Manual to Automatic and then press “Apply”. This should make Elasticsearch start automatically on server boot.

This window contains some more options such as how much memory Elasticsearch will use. You can find this under the “Java” tab. I would suggest to make this fitfor your server if you have a server that will handle a huge amount of logs. I would increase the “Maximum Memory Pool: 1024” at least to a higher amount.

Before you close the window make sure to press “Start” so it actually will run right now 🙂

This is everything to start ElasticSearch automatically on boot. To test that it is working, open a browser and go to this url:

If you see a json string something like what you see below in the picture then it means it is running:

Step 11: Start Logstash & Autostart it
For this step we need another small program to create a proper Windows service, so please go ahead and download “NSSM” (the Non-Sucking Service Manager) from:

Once you have the zip file simply unzip it and copy the file from the unzipped folder you now have: “nssm-2.23\win64” (nssm.exe) to “C:\basefarm\logstash\bin” so it should result in you having “C:\basefarm\logstash\bin\nssm.exe”.

I know you technically do not have to copy this file but just to keep things clean and to have this available for any future use you never know. 🙂

Now open a Command Prompt and type:
cd C:\basefarm\logstash\bin

And then type the following:
nssm install logstash

You will now see a GUI to create a server fill in the following:
Path: C:\basefarm\logstash\bin\logstash.bat
Startup directory: C:\basefarm\logstash\bin
Arguments: agent -f C:/basefarm/logstash/bin/logstash.conf

It should look like this:

If all looks okay double check on the “Details” tab that “Startup Type” is set to “Automatic” and then press “Install service”. This should be all for Logstash to automatically start on server boot.

If you wish to adjust the memory Logstash does use then simpely open the file “C:\basefarm\logstash\bin\logstash.bat” and the change the following two lines accordingly to the amount of memory you wish it to use:
set LS_MIN_MEM=256m
set LS_MAX_MEM=1g

Step 12: Edit your host file (optional)
This step I only do because I run everything on a test server with no internet connection.

open: C:\Windows\System32\drivers\etc\hosts

Now add:

And save the file.

Now reboot your server so you can test that everything is automatically coming online.

This is all you should have to do once the server is back online you have logstash up and running so just go to:

And you should see:

As you can see, your Kibana IIS logs are shipped now to the Logstash instance.

Just remember, if you run this website over the internet you probably need to make sure port 9200 is accessible but I would restrict it to internal use only so Kibana can reach it but not the outside world.

If you want to ship logs from another server to your loghost server I would suggest to have a look into a program called “nxlog” ( this is a fairly simple way of shipping logs to Lgstash and works perfect on Wndows.

If you have any suggestions to improve this guide then please feel free to or update the configs on GitHub or to provide me the information so I can update the guide and help others!

I also would like to thank “Milo Bofacher” for pointing to “nssm” and “nxlog”!

How to install Logstash with Kibana interface on RHEL

This post is currently outdated, please have a look here to see a up to date version:
This guide will be updated as soon as possible.

In this guide I will provide an example of how to set up a Logstash server with a Kibana interface that does get the logs from rsyslog. While there are multiple other ways to get logs into Logstash I will focus in this guide on rsyslog only.

I am aware that in the new Logstash rpm everything such as Kibana is merged into one package, But I feel personally it is better to install things separate as this gives you the possibility to update certain parts when you want without having to wait for a new rpms.

If you are going to use this in a production environment then please make sure to check the security implications of going the rsyslog way as you would need to open a port. So unless you are in an internal network everyone will be able to ship logs to your Logstash server.

So what is Logstash!?:
“Logstash is a tool for managing events and logs. You can use it to collect logs, parse them, and store them for later use (like, for searching). Speaking of searching, Logstash comes with a web interface for searching and drilling into all of your logs.”

There are a lot of examples on the official Logstash so I definitely recommend having a look there!
Their website:

Now let’s start, for this guide I will be using the following programs:
RHEL (I am using RHEL 6 for this guide)

Step 1: Install Logstash
$ sudo yum localinstall

Since the RHEL 6 Nginx version is pretty old I will install a more upstream version from the Nginx website.

Step 2: Install the Nginx yum repository
$ sudo yum localinstall

Step 3: Add the official ElasticSearch repository for Version 1.1.x
$ sudo vi /etc/yum.repos.d/elasticsearch.repo

Step 4: Add the following content to this file
name=Elasticsearch repository for 1.1.x packages

If you have the supplementary repository of RHEL6 enabled please use 5a which I recommend as
it will use the official oracle jave, if you do not use this please use 5b.
Step 5a: Install all required packages (with the supplementary repository)
$ sudo yum install java-1.7.0-oracle elasticsearch nginx rsyslog tar wget vim policycoreutils-python zip

Step 5b: Install all required packages (without supplementary repository)
$ sudo yum install java-1.7.0-openjdk elasticsearch nginx rsyslog tar wget vim policycoreutils-python zip

Step 6: Go to the Logstash config directory
$ cd /etc/logstash/conf.d

Step 7: Download the following Logstash config file
$ sudo wget

Step 9: Change the ownership of the Logstash config file
$ sudo chown logstash:logstash logstash.conf

Step 10: Create the following directories:

$ sudo mkdir -p /var/log/nginx/kibana
$ sudo mkdir -p /usr/share/nginx/kibana/public
$ sudo mkdir -p /etc/nginx/sites-available
$ sudo mkdir -p /etc/nginx/sites-enabled

Step 11: Go to the nginx directory
$ cd /etc/nginx/

Step 12: Delete the current nginx.conf
$ sudo rm -rf nginx.conf

Step 13: wget a new nginx.conf
$ sudo wget

Step 14: Open the new nginx.conf
$ sudo vim /etc/nginx/nginx.conf

Step 15: Change the following line to fit your cpu amount
worker_processes 1;
worker_connections 1024;

I have two virtual CPUs so I use:
worker_processes 2;
worker_connections 2048;

I feel personally there is not much point going above 4 worker processes however opinions are split about this.
Just save the file after you added your changes.

Step 16: Go to the nginx vhost directory
$ cd /etc/nginx/sites-available/

In this up to date guide I will use the official kibana vhost that kibana provides you can see it here:

However I added a few small changes, so you can use the above official one or use my updated one see what fits you, I will
be using mine that is based on the official one for this guide.

Step 17: wget the kibana vhost file
$ sudo wget

As you can see in my vhost file I disabled the password protected endpoints you can enable them by removing the # and by creating a password file. (not part of this guide)

Step 18: Open the kibana vhost file
$ sudo vim /etc/nginx/sites-available/kibana

Step 19: Change the site name
Simply change the “” to whatever your Logstash url will be and save the file.

Step 20: Symbolic link the vhost file so nginx will load it
$ sudo ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana

Step 21: go to the kibana folder
$ cd /usr/share/nginx/kibana/public

Step 22: Download the latest Kibana version
$ sudo wget

Or if you are like me you can get a newer version directly from their GitHub. (can be experimental)
$ sudo wget

Step 23: Untar Kibana and fix directory stucture

$ sudo tar xzfv kibana-latest.tar.gz
$ sudo mv kibana-latest/* .
$ sudo rm -rf kibana-latest.tar.gz
$ sudo rm -rf kibana-latest

If you did download the “” file you will need to do the following instead:

$ sudo unzip master
$ sudo mv kibana-master/src/* .
$ sudo rm -rf master
$ sudo rm -rf kibana-master

Step 24: Open the config.js file
$ sudo vi config.js

Step 25: Change the file slightly
Change the following line:
default_route : '/dashboard/file/default.json',

To the following:
default_route : '/dashboard/file/ulyaoth.json',

If you want to use another dashboard simpely change the “ulyaoth.json” part.

I changed it myself to “basefarm.json”.

Step 26: Go to the dashboard directory
$ cd /usr/share/nginx/kibana/public/app/dashboards

Step 27: Download the following version of logstash.json
$ sudo wget

My version is identical to the official one except I changed the graph size and how the logs show.

Since I changed the name of the file in config.js to basefarm.json I would need to rename the file.

Step 28: Rename the file
$ sudo mv ulyaoth.json basefarm.json

Step 29: open basefarm.json (or whatever name you used)
$ sudo vi basefarm.json

Step 30: Change the site name
Change the following line:
“title”: “Ulyaoth: Logstash Search”,

Change the bit “Ulyaoth: Logstash Search”,to whatever you would like to name your Kibana interface site and save the file.
For me it is currently called “Basefarm: Logstash Search”.

Step 31: Create a nologin user called kibana
$ sudo useradd -s /sbin/nologin kibana

Step 32: Chown the web dir to kibana:nginx
$ sudo chown -R kibana:nginx /usr/share/nginx/kibana/

Step 33: Start Logstash, ElasticSearch and Nginx

$ sudo service elasticsearch start
$ sudo service logstash start
$ sudo service nginx start

If you now go to your website for example for me “” you will see something like this:

Logstash is a product that is always in development so the screenshot above is outdated probably by now as they keep changing the interface, I would advise to keep my version of the interface as a grain of salt and experiment yourself with how you want to look.

You can do so by playing around with the dashboard files, everyone has his or her own taste so I decided to not make this part of my guide but just focus on how to install it.

Of course there is no data so let us move forward and do the rsyslog configuration that will ship the specific logs to your Logstash server.

Step 34: Create the rsyslog logstash file
$ sudo vi /etc/rsyslog.d/logstash.conf

Step 35: add the logs you want to ship (nginx example)

$ModLoad imfile

$InputFileName /var/log/nginx/kibana/error.log
$InputFileTag kibana-nginx-errorlog:
$InputFileStateFile state-kibana-nginx-errorlog

$InputFileName /var/log/nginx/kibana/access.log
$InputFileTag kibana-nginx-accesslog:
$InputFileStateFile state-kibana-nginx-accesslog

$InputFilePollInterval 10

if $programname == 'kibana-nginx-errorlog' then
if $programname == 'kibana-nginx-errorlog' then ~
if $programname == 'kibana-nginx-accesslog' then
if $programname == 'kibana-nginx-accesslog' then ~

Step 36: restart rsyslog
$ sudo service rsyslog restart

This is it everything should be working now 🙂 you should now be seeing something like this if you go to your Logstash website:

Some more information about the rsyslog config:
“$InputFileName” Here you specify the log you want to sent to logstash
“$InputFileTag” This is the name you will see in logstash

I think by seeing the Nginx example you will get the picture and can change it so it will work for any kind of logs you would like to ship to Logstash. Please remember to add the “if $programname” two times and the second time it has to end with “then ~”if you do not do this, you will spam your “/var/log/messages”.

There is another way to ship logs from the Logstash server itself you can alter the configuration file from “/etc/logstash/conf.d/logstash.conf” to directly read the log files. You will need to change the “input” to something like this:
input {
syslog {
type => syslog
port => 5544
codec => plain { charset => “ISO-8859-1” }

file {
type => “syslog”
path => [ “/var/log/nginx/kibana/*.log”, “/var/log/nginx/error.log” ]

filter {
mutate {
add_field => [ “hostip”, “%{host}” ]
dns {
reverse => [ “host” ]
action => “replace”

output {
elasticsearch {
host => “localhost”

Remember this part only works from the Logstash server itself. It is just a way to avoid using ryslog on the Logstash server itself.

*problems that could occur*
There is a bug in Logstash currently that it can only handle utf8 if your log is different then this it will crash Logstash a workaround is as you can see above to add the following:

codec =>; plain { charset =>; “ISO-8859-1” }

The below information is only required probably if you use selinux and a firewall, I had this not enabled in my virtual machines so you might need to double check the below.
EXTRA INFORMATION: Fix selinux and firewall
$ sudo chcon -R -t httpd_sys_content_t /usr/share/nginx/kibana/public/
$ sudo semanage port -a -t http_port_t -p tcp 9200
$ sudo iptables -A INPUT -p tcp -m tcp --dport 5544 -j ACCEPT
$ sudo iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ sudo iptables -A INPUT -p tcp -m tcp --dport 9200 -j ACCEPT
$ sudo /sbin/service iptables save

I hope this guide has helped you if you see any mistakes or have improvements please give me a reply and I will update the guide accordingly I am always happy to hear improvements.