169 Followers
·
Follow

Quick start using ElasticSearch, Kibana with ASP.Net Core 2.0

Image for post
Image for post

ElasticSearch and Kibana are two great products to use in your solution. They provide various values to a solution. If you don’t know ElasticSearch and Kibana then I recommend you read more about these technologies or follow me to get more insight on them.

Prerequisites

Create new project folder

Open a command prompt and run the following commands:

Create new ASP.Net Core project

In the command line create a new ASP.Net Core web application.

The following additional packages are needed to log information to ElasticSearch using Serilog.

Update Startup.cs file to enable logging to ElasticSearch

By enabling the logging from your web application to ElasticSearch you need to make the following changes in the Startup.cs file.

Use Docker to startup and use ElasticSearch and Kibana

In the command line run the following Docker commands to download an ElasticSearch with Kibana docker image.

It can take a while to download the docker image from the docker registry. Once the download is finished, you can confirm if an instance is running of the image by executing the following command.

Image for post
Image for post
Docker running container images.

Run your ASP.Net Core project

Now you must run your ASP.Net Core web application for example from the command line.

Open the web application in your favorite browser: http://localhost:5000

Click around in the web application to generate web traffic. You have to generate first some web traffic before opening the Kibana web application.

Setup and use Kibana

Open in your favorite browser the following URL: http://localhost:5601

This will open the Kibana application. The first thing to do is to configure the index pattern before you can start using the goodies in the Kibana web application.

Image for post
Image for post
Configure index pattern in Kibana.

After the index pattern is configured then you can click on the Discover menu option to see each of the logging information generated by the web requests you have created.

Image for post
Image for post
Web application logging information in Kibana.

Feel free now to explore and create vizualizations, dashboards and timelines in Kibana based on the logging information.

Summary

ElasticSearch and Kibana provides many benefits to you which you can utilize in your web application solution. ElasticSearch specifically is a great search engine that you can use as a view cache to search quickly through information. There is a lot more capabilities ElasticSearch and Kibana have for you to explore and use in your next great ASP.Net Core 2.0 solution.

With the help of containers you can get setup quickly and deploy your solution quickly to any environment. Let me know how you use ElasticSeach and Kibana in your solutions!

Written by

Passion for Software and Enterprise Architecture. I like to play with Azure and programming languages (C#, Rust, JavaScript and Angular).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store