Elasticsearch, Logstash & Kibana Deployment How To.: Faisal Sikander Khan Senior System Administrator
Elasticsearch, Logstash & Kibana Deployment How To.: Faisal Sikander Khan Senior System Administrator
By:
Faisal Sikander Khan
Senior System Administrator
Objective
Install ELK on Ubuntu 18.04 Bionic Beaver
Distributions
Ubuntu 18.04
Requirements
A working install of Ubuntu 18.04 with root privileges
Difficulty
Easy
Conventions
• # - requires given linux commands to be executed with root privileges either directly as a root
user or by use of sudo command
• $ - requires given linux commands to be executed as a regular non-privileged user
What is ELK
If you're in a situation where you manage large amonts of data logs, the ELK stack is exactly what you're
looking for. The ELK stack combines Elasticsearch, Logstash, and Kibana into a simple, yet powerful,
open source stack that lets you manage large amounts of logged data from a convenient graphical web
interface. All three tools are developed by Elastic, so they work in tandem perfectly, and they're very
easy to get set up on your Ubuntu system.
Logstash doesn't support Java 10, which is available on Bionic from openjdk-11-jre. If you have it
installed on your system, remove it. Use the older version until Logstash gets support.
You need to edit the Kibana configuration file at /etc/kibana/kibana.yml to tell it that the host server
is localhost. The line is already there. Uncomment it.
server.host: "localhost"
Restart Kibana and start up Elasticsearch, and both will be ready to go.
$ sudo systemctl restart kibana
Set Up Nginx
Kibana is served through Nginx, so you need to set up a basic Nginx configuration to get it to serve your
instance of Kibana. Start by creating a password for Kibana. This way, your server isn't accessible openly
on the Internet. Use OpenSSL to generate the password, and place it in /etc/nginx/htpasswd.kibana. You
can change the username to anything you want. In this instance, it's admin.
listen 80;
server_name your-site.com;
auth_basic_user_file /etc/nginx/htpasswd.kibana;
location / {
proxy_pass http://localhost:5601;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
After you have your configuration, remove the existing default config, and create a new symlink in sites-
enabled for Kibana.
$ sudo rm /etc/nginx/sites-enabled/default
Install Logstash
The last thing that you need to do is install Logstash. Just install it with your package manager.
$ sudo apt install logstash
Sign In To Kibana
Open up your browser, and go to the address that you assigned to your Kibana instance in the Nginx
configuration. You should be prompted to enter the username and password that you set up for Kibana.
Enter them.
You'll see the Kibana dashboard appear, fully operational. You can begin using Kibana and setting up
your preferences.
Closing Thoughts
Your ELK stack is fully operational on Ubuntu. ELK can help you manage your logs, and Kibana specifically
has some excellent tools to help you visualize and organize that data.