Over a million developers have joined DZone.

Installing the ELK Stack on Windows

This article will guide you through the necessary steps to install the ELK Stack’s components as Windows services.

· Integration Zone

Is iPaaS solving the right problems? Not knowing the fundamental difference between iPaaS and dPaaS could cost you down the road. Brought to you in partnership with Liaison Technologies.

featured-image

Windows? ELK? Well, while it would be safe to assume that most ELK Stack deployments are on Linux-based systems, there are certain use cases in which you would want to install the stack on a Windows machine.

If you’re looking to log Windows event logs, for example, and you do not want to ship the logs over the Web to an ELK server for security reasons, you’re going to want to deploy the stack locally.

This article will guide you through the necessary steps to install the ELK Stack’s components as Windows services. Note: This example will use Elasticsearch, 2.3.5, Logstash 2.3.4, and Kibana 4.5.4.

The Setup

I’ll be using a Windows 2012 R2 instance on Amazon Web Services. The operating system is just a basic Server 2012 R2 installation — but with updates and a disabled firewall. I’ve also installed an Apache server for the purpose of demonstrating how to log into ELK.

Elasticsearch and Logstash require Java, so you will also need to download and install it — JDK and NOT JRE — and create a JAVA_HOME system variable as well.

Adding JAVA system variable

Installing Elasticsearch

Our first step is to install Elasticsearch — the heart of the stack, if you like, that is responsible for storing and indexing the log data.

You can download the latest version of Elasticsearch from Elastic’s Elasticsearch download page. Extract the downloaded package into a designated folder in your file system (e.g. c:\elk).

Next, open a Powershell prompt and enter the following command (be sure to enter your installation path in the command):

You should get an output that looks as follows:

Next, we’re going to open the service manager for the Elasticsearch service:

Service manager for Elasticsearch

This is where you customize settings for Elasticsearch. Memory for JVM, for example, can be configured on the Java tab, which is important for when you start to ingest large quantities of data.

On the General tab, we’re going to select the “Automatic” startup type and hit the “Start” button to start Elasticsearch. To make sure that all is running as expected, enter the following URL into your browser:

http://localhost:9200


You should get the following output:

{
    "name" : "Andrew Chord",
    "cluster_name" : "elasticsearch",
    "version" : {
        "number" : "2.3.5",
        "build_hash" : "90f439ff60a3c0f497f91663701e64ccd01edbb4",
        "build_timestamp" : "2016-07-27T10:36:52Z",
        "build_snapshot" : false,
        "lucene_version" : "5.5.0"
    },
    "tagline" : "You Know, for Search"
}


Installing Logstash

Next up is Logstash. Now, there are a number of ways to install Logstash on Windows, but it cannot be installed as a service out-of-the-box. So, I’ll be using a service manager called Non-Sucking Service Manager (NSSM), which I have downloaded and extracted into the folder that contains all of our installed ELK packages.

Now, download and extract Logstash from the Logstash download page to the same folder.

Before installing Logstash NSSM, create a Logstash configuration file called “config.json” and place it in the “bin” directory.

Next, enter the following command in Powershell (be sure to update the paths invoked):

You should see the NSSM dialog:

NSSM service installer for Logstash

For the application path, browse to and select the Logstash .bat file. The “Startup” directory field below is completed automatically. In the “Arguments” field, enter:

-f c:\elk\logstash\bin\config.json


Click the “Install Service” button and a success message will be displayed. In PowerShell, you will see the following message:

Logstash service installed successfully message

Open Windows Task Manager and start the service from the “Services” tab.

Installing Kibana

As with Logstash, we will install Kibana as a Windows service using NSSM. Download and extract Kibana from the Kibana download page.

Use this command in PowerShell to create the service:

In the NSSM dialog, complete the relevant paths to the Kibana files (there is no need to pass any arguments for Kibana) and click “Install service”:

As with Logstash, start the service from your Task Manager — you should now have all three services up and running!

Service manager - up and running!

To verify, open your browser at this address: http://127.0.0.1:5601.

Kibana open in browser

Congrats! You’ve successfully installed the ELK Stack on your Windows server!

As you may notice — Kibana is notifying you that it could not fetch mapping. This is because you have not shipped any data yet. This is, of course, the next step. If you’re trying to set up a pipeline of Windows event logs into ELK, I described how to install and use Winlogbeat (a log shipper by Elastic for shipping event logs into ELK) in this additional guide to Windows event log analysis.

Discover the unprecedented possibilities and challenges, created by today’s fast paced data climate and why your current integration solution is not enough, brought to you in partnership with Liaison Technologies.

Topics:
elk ,open-source ,windows ,logstash ,elk stack ,stack ,elasticsearch

Published at DZone with permission of Daniel Berman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}