Kibana Course Overview
Kibana Course Overview
In this course, you will be reading about all the ingredients required for a quick hands-on on
Kibana. By the end of the course, you will be aware of the following things:
Setting up Kibana
Getting Started
Discover
Visualize
Dashboard
Timelion
Dev Tools
Management
Introducing Kibana
The audience reading this course must have had an experience with Elasticsearch. In
Elasticsearch, we were restricted to queries and results in JSON. There was no option of
visualizing the data in the form of graphs and charts.
Kibana is a member of the ELK stack family, which is designed to visualize as well as
explore the relations between the data.
Step 2:
Step 3:
Step 4:
Step 5:
Step 1:
https://artifacts.elastic.co/downloads/kibana/kibana-5.5.2-windows-x86.zip
Step 2: Unzip the downloaded file which will result in the creation of a folder called kibana-
5.5.2-windows-x86. Access it in the terminal, for example:
CD c:\kibana-5.5.2-windows-x86
Step 3:
.\bin\kibana
Configuring Kibana
You can find the configuration for Kibana in the file kibana.yml. The default location to run
Kibana is:
localhost:5601
You can open Kibana in your web browser with the following link:
http://localhost:5601/app/kibana
You will also have to link Kibana to Elasticsearch installed on your machine to access
documents. Search for the setting elasticsearch.url in the kibana.yml file and make sure
that it is set to http://localhost:9200.
Did you remember the bank index that we used in the Elasticsearch course? You can set the
index pattern name as "bank" for now to experiment with the data. We will be using it as our
data-set in this course.
Finally, click on "Create" to add the index pattern that you specified. You can add/change the
index pattern anytime under Management > Index Patterns.
Index Pattern
As we mentioned, to navigate through the data, the first thing you need to do is defining the
index pattern.
In addition to defining the complete name of an index in the pattern, you can also take help of
the wildcards that will search for all the index following the pattern. For example,
Setting up the pattern as ba* will search for all the similar pattern index such as
banking, ball, and balancesheet.
Loading Sample Data Set
In case you have not loaded the bank data-set in Elasticsearch, here is the link for the same:
https://download.elastic.co/demos/kibana/gettingstarted/accounts.zip
Once you import the data in Elasticsearch (please refer to the "Elasticsearch - search raptors"
course), you can set the index pattern as "bank".
Quick Fact
Discover
Visualize
Dashboard
Timelion
Management
Dev Tools
On further clicking the fields, you can view the details of top 5 values based on the
document in the table.
account_number:<500
It will return all the documents having field name "account_number" less than
500. Above is the screenshot for the same.
You can specify basic simple strings as well as you can use Apache query syntax for
searching a query.
In upcoming topics, you will learn about several pages like discover, and visualize in detail.
Discover
You can access discover page in Kibana by clicking "Discover" just below the Kibana logoat
the top left corner. Here are the important points regarding discover page in Kibana:
If your Index does not contain a time field, you cannot set the time filter field name. This filter
is used to filter events with the global time filter. We will discuss this functionality at a later
stage.
Searching Data
Upon submitting a search request in the search bar, the histogram, field list, and document
tables are automatically updated to show search results, and the total number of hits is shown
in the toolbar.
The listing is done in reverse chronological order, i.e., newest document is shown first.
Edenburg
balance:49222
account_number:[1 TO 499]
Boolean operators like AND, OR, and NOT can also be used in the search:
Saving a search will save the search query with the index pattern used at the time of
search.
To save a search:
Kibana toolbar > Save > Enter a name > Click Save .
Click on field name that you want to filter. It will display the top 5 values of the field by
default.
You can click add button adjacent to the field name to add values other than top 5 values.
Click upon "Add Filter" present on the left side below the search bar.
In the popup, you can set a filter as given in the example below:
Visualize
Visualize page is the most important page of Kibana as it helps in creating the different types
of visualization corresponding to the data present in Elasticsearch.
b. Creating a visualization.
Bucket Aggregations
As you know, the aggregations are a collection of data which is stored in buckets. In bucket
aggregation, buckets are created to store various documents. Different kinds of bucket
aggregations are:
Metric Aggregations
As the name suggests, metric aggregation is used for computing metrics on documents. It is
used after creating a bucket aggregation. Then, the metric aggregation can be used to
calculate the value of each bucket. Hence, it provides single value per bucket.
Count - This aggregation is used to return total documents present in each bucket as a
value.
Sum - It will return the sum of numeric fields present in each bucket.
Average - It will return in average value of numeric fields present in each bucket.
Min - It will return minimum value from numeric fields present in each bucket.
Max - It will return maximum value from numeric fields present in each bucket.
Unique count - This aggregation is used to count the number of unique values
corresponding to a field stored in the bucket.
Percentile - This aggregation is used to calculate percentile upon numeric values
corresponding to a field stored in the bucket.
Percentile ranks - Used to calculate single or multiple percentile ranks.
Creating a Visualization
To create a visualization:
Click Visualize in side navigation - Create new visualization button - Select visualization
type
The types of visualization we will discuss are:
Basic Charts
Data
Maps
Go to Visualize > Create a visualization.
Select Vertical Bar under Basic charts.
Select the index bank.
Under metrics > Y-axis, select count. You can also give a customized name under Custom
Label.
Go to buckets > Select buckets type > X-axis and select Range in Aggregation.
Select age under Field.
Enter range under From-To text fields i.e. 0-5, 5-10, 10-15, 15-20....till 70-75.
Finally, click Apply changes (Play button). You will get the chart instantly as shown in the
above picture.
Please save the visualizations (by selecting save on top right corner and giving a
name to it) as we will require it during Dashboard creation.
Go to Visualize > Create a visualization.
Select Pie under Basic charts.
Select the index bank.
Under metrics > Slice Size, select count. You can also give a customized name under
Custom Label.
Go to buckets > Select buckets type > Split Slices and select Range in Aggregation.
Select age under Field.
Enter range under From-To text fields i.e. 0-5, 5-10, 10-15, 15-20....till 70-75.
Finally, click on Apply changes (Play button). You will get the pie chart instantly as shown in
the above picture.
Navigate to Visualize > Create a visualization > Area > Select the Index Bank.
Select count aggregation in Y-axis metrics.
Select buckets > select buckets type > Split Chart.
Select Terms in Aggregation and select state.keyword in field.
Select order as descending and size as 1 so that only the topmost populous
state is selected.
Add another sub-bucket and select X-axis. Select terms in sub aggregation.
Select age in field and order by term.
Select order as ascending and size as 50.
You can select line mode as "smoothed" in Metrics and Axes > line mode.
Navigate to Visualize > Create a visualization > Line > Select the Index Bank.
Under Metrics > Y-Axis select Sum as the type of aggregation and select
balance in the field.
Select Bucket type as X-Axis and select Terms in Aggregation .
Select Account number in the field and Order by Term .
Select Ascending in the order and size as 50 (increasing the size will make the plot
complex).
Finally, click the Apply changes button (play button).
Create a Gauge
Gauge indicates the status of metric about a threshold value. Suppose you would like to
view the average age of all the bank account holders. Here are the steps for the same:
Select visualize > Create new visualization > Data > Gauge > Select Index (bank
in our case).
In metric > Aggregation > select average > select age in field.
Click on apply changes button. You can customize the theme in Options.
We will insert these data in Elasticsearch with the help of console in Kibana Dev tools (You
can also use regular Elasticsearch for this). Also, we will have to map the location field to
"geo_point". Here is the procedure for same (next card).
PUT earthquakes
{
"mappings": {
"coordinates": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
PUT earthquakes/coordinates/1
{
"place": "7km S of Breznik, Bulgaria",
"magnitude": "3.2",
"location": "42.670,22.899"
}
Select bucket type as Geo Coordinates, let Geohash be in aggregation and select location in
the field. Finally, click on apply changes. You can customize the view in options.
Dashboard
In this section, you will learn about Dashboard page of Kibana with the visualizations that we
created. This single page acts as a display for more than one visualizations together.
They can be prioritized in any way, resized, replaced and removed. It makes visualizing
data more easy and fast.
Creating a Dashboard
We will create a dashboard with the visualizations that we saved. To create a dashboard:
You will find multiple options like drag and drop, enlarge, remove, etc. Get familiar with these
options by playing around. You can save a dashboard with save option in top right
corner.
Note that all the clients to whom the stuff are shared should have access to Kibana to
view them (visualizations, dashboards, etc.).
Embedding Dashboard in Web Page
Let us take the sample Embedded iframe link of the saved dashboard :
<iframe src="http://localhost:5601/app/kibana#/dashboard/02e0f270-9941-11e7-a327-
a93fe119ec90?embed=true&_g=(refreshInterval%3A(display%3AOff%2Cpause%3A!f%2Cvalue
%3A0)%2Ctime%3A(from%3A'2017-09-14T11%3A34%3A35.544Z'%2Cmode%3Aabsolute%2Cto%3A'2017-09-
14T11%3A49%3A35.544Z'))" height="600" width="800"></iframe>
<html>
<head>
<title>
Test
</title>
</head>
<body>
<iframe src="http://localhost:5601/app/kibana#/dashboard/02e0f270-9941-11e7-a327-
a93fe119ec90?embed=true&_g=(refreshInterval%3A(display%3AOff%2Cpause%3A!f%2Cvalue
%3A0)%2Ctime%3A(from%3A'2017-09-14T11%3A34%3A35.544Z'%2Cmode%3Aabsolute%2Cto%3A'2017-09-
14T11%3A49%3A35.544Z'))" height="600" width="800"></iframe>
</body>
</html>
Quick Fact
Timelion, pronounced as Timeline, is a time series data visualizer that makes it possible to
visualize independent data sources as a unity. Some of the use cases are:
Dev Tools
Dev tools page is used by developers to interact with the data in Kibana more in the
form of query console fashion.
In Dev tools, the console plugin allows you to interact with the REST API of Elasticsearch. It
has two portions, one is the Editor part and other is the Response part displaying response
to the request. While typing a query, you will get related API suggestions from which you can
select the required one, thus saving the time.
GET /_search
{
"query": {
"match_all": {}
}
}
Above screenshot is the Dev tools page with a sample query and response.
Management
The management page of Kibana is used for:
earth-*
This pattern will find all the index such as earthatmosphere, earthwater, earthquakes, etc.
You can also set an Index as the default index, refresh the field list or delete it.
In addition to these, we have an advanced settings page where you can directly control
Kibana's behavior. This section should be handled with utmost care as it can easily damage
and break the application if handled incorrectly.
Kibana Summary
In this course, you studied the basic ingredients required to get started with Kibana. You read
about the tools like Discover, Visualize, Dashboard, Timelion, etc. These tools are very
useful while analyzing an extensive data and helps in revealing hidden relationships within as
well as among the data.
QUIZ :
1. Kibana is an independent tool nothing to do with ELK stack. F
2. Configuration file for Kibana is named as ________. KIBANA.YML
3. Which of the following is an appropriate query to be typed in search bar for getting all documents in
which “state” equals “TX”? STATE.TX
4. Is it necessary to use curl command while querying in Kibana? F
5. What is Kibana?A VISUALIZATION TOOL
6. You can only set the Index pattern once.F
7. Default location to run Kibana is _________. 5601
8. What can be created with the help of Kibana? ALL
9. If Elastic search is not visible via Kibana, what could be the problem? BOTH
10. In bucket aggregation, buckets are created to store _____. DOCUMENTS
11. Visualize page is responsible for __________. ALL
12. Date histogram is performed on date/time values that are automatically extracted from documents.
T
13. Geohash is used to create buckets based upon ________. geo_point fields.
14. chronological order MEANS
15. Which of the following is not a metric aggregation? LOG
16. Can Boolean operators like AND, OR etc. can be used in Lucene Query Syntax? YES
17. Where can you access discover page in Kibana? TOP LEFT SIDE
18. Upon searching, the listing is done in chronological order which means ___________. NEWEST
DOCUMENT FIRST
19. Discover is used for ________. BOTH
20. Filters may be ___________. BOTH
21. What will Max Aggregation do? Return Max value from numeric fields present in each bucket
22. Can you share a dashboard as we shared a visualization? YES
23. Percentile ranks are used to calculate single or multiple percentile ranks.T
24. Which of the following is an appropriate query to be typed in search bar for getting all documents in
which “state” equals “TX”? STATE:TX
25. What are the steps to create a coordinate map? Visualize > Create a new visualization > Coordinate
map > Select relevant index.
26. Can we save the visualizations we create in Kibana? YES
27. A dashboard can be embedded in a HTML page. T
28. You can only set the Index pattern once.F
29. Why is Dashboard used for? All of these
30. Timelion is a ______. TIME SERIES DATA VISUALIZER
31. What is the function of Gauge? It indicates the status of metric in reference to a threshold value.
32. We can show multiple dashboards in visualization page – F
33. How can we insert a dashboard into a HTML page - With Embedded iframe