Complete Kibana Tutorial to Visualize and Query Data_1


Welcome to this complete Kibana tutorial where you will learn how to visualize and query data using the popular open-source analytics and visualization platform. Kibana is a user-friendly tool that enables you to analyze and explore your data, creating interactive visualizations and dashboards. By the end of this tutorial, you will be able to use Kibana to create compelling visualizations of your data, making it easier for you to identify trends and patterns, and make informed decisions.

First, let's start by defining Kibana.

What is Kibana?

Kibana is an open-source analytics and visualization platform designed to work with Elasticsearch. It provides you with an interface to search, analyze, and visualize data stored in Elasticsearch indices. Kibana can be used to create various types of visualizations, including line charts, bar charts, pie charts, heat maps, and more. Additionally, Kibana can be used to build interactive dashboards that allow you to monitor key performance indicators (KPIs) and track progress toward your goals.

Now that we know what Kibana is, let's get started with the tutorial. We will begin by installing Kibana on our machine and setting it up to work with Elasticsearch.

Installing Kibana

Kibana can be installed on various platforms, including Windows, Linux, and macOS. In this tutorial, we will be using the Linux installation process, specifically Ubuntu 20.04. Follow the steps below to install Kibana.

Step 1: Install OpenJDK 8

Kibana requires Java 8 to run, so the first step is to install OpenJDK 8 −

sudo apt update sudo apt install openjdk-8-jdk -y

Step 2: Add Kibana GPG Key

Kibana is signed with a GPG key to ensure the authenticity of the software. To add the GPG key to your system, run the following command −

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

Step 3: Add Kibana Repository

Next, add the Kibana repository to your system by running the following command −

echo "deb https://artifacts.elastic.co/packages/oss-7.x/apt stable main"| sudo tee -a /etc/apt/sources.list.d/kibana-7.x.list

Step 4: Install Kibana

Finally, install Kibana by running the following command:

sudo apt update sudo apt install kibana -y

Once Kibana is installed, you can start it by running the following command −

sudo systemctl start kibana

Configuring Kibana

Before we can start using Kibana, we need to configure it to work with Elasticsearch. The configuration file for Kibana is located at /etc/kibana/kibana.yml. Open the file using your favorite text editor −

sudo nano /etc/kibana/kibana.yml

In the file, locate the following line −

#server.host: "localhost"

Uncomment the line and replace "localhost" with the IP address or hostname of your Elasticsearch instance −

server.host: "YOUR_ELASTICSEARCH_IP_OR_HOSTNAME"

Save and exit the file.

Visualizing Data in Kibana

Now that we have Kibana installed and configured, let's start visualizing some data. We will be using the sample data provided by Kibana for this tutorial.

Step 1: Load Sample Data

To load the sample data, open Kibana in your web browser by visiting http://localhost:5601/ and log in with the default username elastic and password changeme. Once logged in, click on the Explore on my own button.

On the next screen, click on the Load a data set button and select the Sample web logs option. This will load the sample data into Elasticsearch, which we can now visualize in Kibana.

Step 2: Creating an Index Pattern

The first step in visualizing our data is to create an index pattern. An index pattern is a way of telling Kibana which Elasticsearch indices we want to work with. To create an index pattern, follow these steps −

  • Click on the Management tab in the left-hand menu.

  • Click on Kibana > Index Patterns.

  • Click on the Create index pattern button.

  • In the Index pattern field, enter logs* (without the quotes).

  • Click on the Next step button.

  • In the Time Filter field name dropdown, select @timestamp.

  • Click on the Create index pattern button.

We have now created an index pattern for our sample data.

Step 3: Creating a Visualization

Now that we have our index pattern set up, let's create our first visualization. We will be creating a vertical bar chart that shows the count of HTTP methods used in our web logs. Follow these steps −

  • Click on the Visualize tab in the left-hand menu.

  • Click on the Create a visualization button.

  • Select Vertical bar chart as the visualization type.

  • In the Choose a search source step, select logs* as the index pattern.

  • In the Metrics tab, select Count as the metric.

  • In the Buckets tab, select X-axis as the bucket type.

  • In the Aggregation dropdown, select Terms.

  • In the Field dropdown, select http.method.

  • Click on the Play button to see your visualization.

You should now see a bar chart showing the count of HTTP methods used in your web logs.

Step 4: Creating a Dashboard

Dashboards are a way of bringing multiple visualizations together into a single view. Let's create a dashboard that contains the bar chart we created in the previous step −

  • Click on the Dashboard tab in the left-hand menu.

  • Click on the Create dashboard button.

  • Click on the Add button.

  • Select the bar chart we created in the previous step.

  • Click on the Save button.

You should now see a dashboard containing your bar chart.

Conclusion

Congratulations! You have completed this Kibana tutorial and learned how to visualize and query data using Kibana. We covered the installation and configuration of Kibana, creating an index pattern, creating a visualization, and creating a dashboard. Kibana provides a powerful and user-friendly interface for exploring and analyzing data, allowing you to quickly identify trends and patterns in your data. With Kibana, you can easily create visualizations and dashboards that help you make informed decisions based on your data.

Updated on: 22-Jun-2023

194 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements