/SpringBootElk

The usage of ELK(Elastic Search, Logstash, Kibana) in Spring Boot

Primary LanguageJava

Spring Boot ELK(ElasticSearch, Logstash, Kibana)

Main Information

📖 Information

  • The aim of app manages collect logs from app through Logstash and then analyze them in ElasticSearch before visualizing them in Kibana
  • Here is the explanation of the project
    • docker-compose reads variables from .env file.
    • Implement the process of all CRUD operations to add logs through Postman
    • Send Logs defined in configuration to Logstash through Filebeat
    • Collect logs and transfrom them through Logstash
    • Search and analyze them through ElasticSearch
    • Visualize and manage them through Kibana

🔨 Run the App

Maven

1 ) Download your project from this link https://github.com/Rapter1990/SpringBootElk

2 ) Go to the project's home directory : cd SpringBootElk

3 ) Create a jar file though this command mvn clean install

4 ) Run the project though this command mvn spring-boot:run

Docker

1 ) Install Docker Desktop. Here is the installation link : https://docs.docker.com/docker-for-windows/install/

2 ) Look at the .env file in project's root directory if database schema, username or password are needed to be changed

3 ) Use the command to read variables from .env file.

    docker-compose config

4 ) Open Terminal under resources folder to run all containers on Docker Container

    docker-compose up -d

5 ) Open ElasticSearch in the Browser

    http://localhost:9200

6 ) Show Indexs in the ElasticSearch

    http://localhost:9200/_cat/indices?v

7 ) Open Kibana in the Browser

    http://localhost:5601/

8 ) Explore Rest APIs

Method Url Description Valid Request Body Valid Request Params
POST /api/api/persons/save Save Person Info
PUT /api/api/persons/{id} Update Person By Id Info
GET /api/api/persons/{id} Get Person By Id Info
GET /api/api/persons Get all Persons Info
DELETE /api/api/persons/{id} Delete Person By Id Info

Used Dependencies

  • Spring Boot Web
  • ElasticSearch
  • Logstash
  • Kibana
  • Filebeat

Valid Request Body

    {
        "username" : "person1",
        "name" : "Person 1 ÜĞİŞÇÖüğişçö",
        "surname" : "Person 1 Surname",
        "email" : "person1@person.com",
        "birthDate" : "2022-04-13",
        "password" : "111111"
    }
   {
       "username" : "person1",
       "name" : "Person 1 ÜĞİŞÇÖüğişçö Updated",
       "surname" : "Person 1 Surname Updated",
       "email" : "person1_updated@person.com",
       "birthDate" : "2022-04-12",
       "password" : "222222"
   }

Valid Request Params

   http://localhost:8077/api/api/persons/26
   http://localhost:8077/api/api/persons
   http://localhost:8077/api/api/persons/26

Screenshots

Click here to show the screenshots of project

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Figure 6

Figure 7