Giter VIP home page Giter VIP logo

dotnet-api-elasticsearch-kibana-serilog's Introduction

C#.NET 8 API with Elasticsearch, Kibana, and Serilog Integration

Welcome to the .NET API with Elasticsearch, Kibana, and Serilog Integration project! This repository demonstrates how to build a .NET API that integrates with Elasticsearch for logging, visualizes logs in Kibana, and uses Serilog for structured logging. The project follows best practices and is built with .NET 8.

Table of Contents

Features

  1. API Endpoints:

    • Provides a sample Product API with endpoints to retrieve product details.
    • Implements structured logging using Serilog.
  2. Elasticsearch Integration:

    • Logs API activity to Elasticsearch for efficient search and analysis.
    • Configurable Elasticsearch sink for Serilog.
  3. Kibana Dashboard:

    • Visualizes logs in Kibana.
    • Helps in monitoring and troubleshooting with rich data insights.
  4. Global Error Handling:

    • Implements global error handling middleware.
    • Logs detailed error information including request and response context.

Installation

To install and run the application, follow these steps:

  1. Clone the repository from GitHub:
git clone https://github.com/Hemmatiali/dotnet-api-elasticsearch-kibana-serilog.git
cd dotnet-api-elasticsearch-kibana-serilog
  1. Ensure Docker is installed and running on your machine.

  2. Build and start the Docker containers:

docker-compose up --build

Debugging the Application

  1. Stopping Docker Containers:
docker-compose down
  1. Debugging with Visual Studio:
    • Open the solution in Visual Studio.
    • Ensure Docker support is enabled.
    • Set the project as the startup project.
    • Press F5 to start debugging.

Examples

API Endpoint Retrieve a product by ID:

Swagger http://localhost:5297/swagger
GET http://localhost:5297/api/product/-1

Log Visualization in Kibana

  1. Open Kibana at:
http://localhost:5601
  1. Navigate to the "Discover" tab.
  2. Select the index pattern corresponding to your logs (e.g., logstash-*).
  3. Use the following search query to filter error logs:
level: "Error"

ElasticSearch Open Elasticsearch at:

http://localhost:9200

Documentation and Comments

The code is thoroughly documented with XML comments explaining the functionality of each component and method. Clear instructions are provided on how to build, run, and use the application.

License

This project is licensed under the MIT License - see the LICENSE file for details.

dotnet-api-elasticsearch-kibana-serilog's People

Contributors

hemmatiali avatar

Stargazers

Ahmadreza Iraji avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.