Skip to main content

kibana

Canvas # 🎛 Installing and Configuring the Kibana Dashboard 🚀

Kibana is a powerful visualization tool that works with Elasticsearch to help you explore, analyze, and visualize data in real time. It provides intuitive dashboards, charts, and search capabilities for your log and metric data.

📌 Step 1: Install Kibana 🛠

sudo apt install kibana

📌 Step 2: Enable and Start Kibana Service ⚡

sudo systemctl enable kibana
sudo systemctl start kibana

By default, Kibana is configured to listen only on localhost (127.0.0.1). To access it externally, we need to set up a reverse proxy using Nginx.

📌 Step 3: Setting Up Nginx as a Reverse Proxy 🌍

Before proceeding, ensure that Nginx is installed on your server. If not, install it using:

sudo apt install nginx

📌 Step 4: Create an Administrative Kibana User 🔐

To enhance security, we will create a username and password that will be required to access Kibana via the Nginx reverse proxy. The following command will create a hashed password and store it in the /etc/nginx/htpasswd.users file.

echo "asifkibana:`openssl passwd -apr1`" | sudo tee -a /etc/nginx/htpasswd.users

💡 Replace asifkibana with your own username and enter a strong password when prompted.

Example password: Kibana@123 (🔴 Do not use this in production!)

📌 Step 5: Configure Nginx Reverse Proxy 🖥

We will create an Nginx server block to route traffic from an external domain (elk.asifahmadkhan.com) to Kibana running on localhost:5601.

📝 Create a new Nginx configuration file:

sudo vi /etc/nginx/sites-available/elk.asifahmadkhan.com.conf

✍ Add the following configuration:

server {
listen 80;

server_name elk.asifahmadkhan.com;

auth_basic "Restricted Access"; # Protect with Basic Authentication
auth_basic_user_file /etc/nginx/htpasswd.users; # Use the created user credentials

location / {
proxy_pass http://localhost:5601; # Forward requests to Kibana
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

📌 Step 6: Enable the Nginx Configuration 🔄

Create a symbolic link to enable the site:

sudo ln -s /etc/nginx/sites-available/elk.asifahmadkhan.com.conf /etc/nginx/sites-enabled/

Then test the Nginx configuration:

sudo nginx -t

If there are no errors, restart Nginx:

sudo systemctl restart nginx

📌 Step 7: Allow Nginx Traffic Through Firewall 🔥

sudo ufw allow 'Nginx Full'

🎉 Final Step: Access Kibana ✅

Now, open your browser and go to:

http://elk.asifahmadkhan.com

You will be prompted for a username and password (the one created in Step 4). Enter your credentials and start exploring the Kibana dashboard! 🚀


🔹 Ensure that you have configured the DNS settings for elk.asifahmadkhan.com to point to your server's IP address.
🔹 For enhanced security, consider enabling HTTPS using an SSL certificate (e.g., Let's Encrypt).

If you hit IP:5601 and it gives an error, then check the following in the kibana.yml file: Change it from:

server.host: "localhost"

to:

server.host: "0.0.0.0"