{"id":18073324,"url":"https://github.com/mehedi32hstu/spring-boot-microservice","last_synced_at":"2026-04-11T08:04:05.067Z","repository":{"id":258527931,"uuid":"865322070","full_name":"Mehedi32HSTU/spring-boot-microservice","owner":"Mehedi32HSTU","description":"This project showcases a microservices architecture with essential tools including centralized logging using ELK Stack, API Gateway for request routing, Service Discovery for dynamic service registration, and a Circuit Breaker for fault tolerance. Scalable and resilient design ensures smooth service communication and monitoring.","archived":false,"fork":false,"pushed_at":"2024-10-31T04:21:45.000Z","size":104,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T18:16:40.258Z","etag":null,"topics":["actuator-spring-boot","api","bulkhead-isolation","circuit-breaker","config-server","configuration-management","elasticsearch","eureka-server","hystrix","java","kibana","logstash","microservices","spring-boot","spring-cloud-gateway","swagger-ui"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mehedi32HSTU.png","metadata":{"files":{"readme":"README_CENTRALIZED_LOGGING_ELK.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-30T10:47:22.000Z","updated_at":"2024-10-18T10:18:28.000Z","dependencies_parsed_at":"2024-10-20T13:08:39.895Z","dependency_job_id":null,"html_url":"https://github.com/Mehedi32HSTU/spring-boot-microservice","commit_stats":null,"previous_names":["mehedi32hstu/spring-boot-microservice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mehedi32HSTU%2Fspring-boot-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mehedi32HSTU%2Fspring-boot-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mehedi32HSTU%2Fspring-boot-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mehedi32HSTU%2Fspring-boot-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mehedi32HSTU","download_url":"https://codeload.github.com/Mehedi32HSTU/spring-boot-microservice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378141,"owners_count":20929296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actuator-spring-boot","api","bulkhead-isolation","circuit-breaker","config-server","configuration-management","elasticsearch","eureka-server","hystrix","java","kibana","logstash","microservices","spring-boot","spring-cloud-gateway","swagger-ui"],"created_at":"2024-10-31T10:06:07.722Z","updated_at":"2026-04-11T08:04:00.026Z","avatar_url":"https://github.com/Mehedi32HSTU.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Centralized Logging with ELK Stack\n\nThis README provides step-by-step instructions on how to configure centralized logging for multiple microservices (`CUSTOMER-SERVICE`, `ORDER-SERVICE`, and `PRODUCT-SERVICE`) using the ELK stack.\n\n## Prerequisites\n\n- **Install Elasticsearch**: \n    1. Download Elasticsearch from the official site: https://www.elastic.co/downloads/elasticsearch\n    2. Extract the downloaded archive.\n    3. In the `elasticsearch.yml` file, locate the following setting and change it as following:\n     ```yaml\n        # --------------------------------------------------------------------------------\n        # Enable security features\n        xpack.security.enabled: false\n        \n        xpack.security.enrollment.enabled: false\n        \n        # Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents\n        xpack.security.http.ssl:\n        enabled: false\n        keystore.path: certs/http.p12\n        \n        # Enable encryption and mutual authentication between cluster nodes\n        xpack.security.transport.ssl:\n        enabled: false\n        verification_mode: certificate\n        keystore.path: certs/transport.p12\n        truststore.path: certs/transport.p12\n        # Create a new cluster with the current node only\n        # Additional nodes can still join the cluster later\n  \n     ```\n    4. Start Elasticsearch: `./bin/elasticsearch`\n    5. Read details here: https://stackoverflow.com/questions/71492404/elasticsearch-showing-received-plaintext-http-traffic-on-an-https-channel-in-con\n    6. By default, Elasticsearch runs on `http://localhost:9200`\n    7. View attributes: `http://localhost:9200/_cat`\n\n\n- **Install Kibana**:\n    1. Download Kibana from: https://www.elastic.co/downloads/kibana\n    2. Extract the archive.\n    3. In the `kibana.yml` file, locate the following setting and uncomment it:\n\n    ```yaml\n      # Uncomment this line to point to your local Elasticsearch instance\n      elasticsearch.hosts: [\"http://localhost:9200\"]\n    ```\n    4. Start Kibana: `./bin/kibana`\n    5. Kibana will run on `http://localhost:5601`\n\n- **Install Logstash**:\n    1. Download Logstash from: https://www.elastic.co/downloads/logstash\n    2. Extract the archive.\n    3. You will configure Logstash to process logs from your microservices.\n\n- **Java Microservices**: You should have logback configured in your Spring Boot applications.\n\n---\n\n## Step 1: Configuring Logback in Microservices\n\nEach microservice will log to its own file in JSON format. Below is the `logback-spring.xml` configuration for each service.\n\n### Logback Configuration for `CUSTOMER-SERVICE`\n\n```xml\n\u003cconfiguration\u003e\n    \u003cproperty name=\"serviceName\" value=\"Microservice-CUSTOMER\" /\u003e\n\n    \u003cappender name=\"CONSOLE\" class=\"ch.qos.logback.core.ConsoleAppender\"\u003e\n        \u003cencoder\u003e\n            \u003cpattern\u003e%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n\u003c/pattern\u003e\n        \u003c/encoder\u003e\n    \u003c/appender\u003e\n\n    \u003cappender name=\"FILE\" class=\"ch.qos.logback.core.FileAppender\"\u003e\n        \u003cfile\u003eC:/path/to/logs/CUSTOMER-SERVICE.log\u003c/file\u003e\n        \u003cencoder class=\"net.logstash.logback.encoder.LogstashEncoder\"\u003e\n            \u003ccustomFields\u003e{\"serviceName\": \"${serviceName}\"}\u003c/customFields\u003e\n        \u003c/encoder\u003e\n    \u003c/appender\u003e\n\n    \u003croot level=\"INFO\"\u003e\n        \u003cappender-ref ref=\"CONSOLE\" /\u003e\n        \u003cappender-ref ref=\"FILE\" /\u003e\n    \u003c/root\u003e\n\u003c/configuration\u003e\n```\n\n*** Repeat this configuration for ORDER-SERVICE and PRODUCT-SERVICE, adjusting the \u003cproperty\u003e and \u003cfile\u003e paths as needed.\n\n## Step 2: Configuring Logstash\nLogstash will aggregate and forward the logs to Elasticsearch.\nCreate a `logstash.conf` file with the following content:\n\n```conf\ninput {\n  file {\n    path =\u003e \"C:/path/to/logs/CUSTOMER-SERVICE.log\"\n    start_position =\u003e \"beginning\"\n    sincedb_path =\u003e \"NUL\"\n    type =\u003e \"customer-service\"\n  }\n\n  file {\n    path =\u003e \"C:/path/to/logs/ORDER-SERVICE.log\"\n    start_position =\u003e \"beginning\"\n    sincedb_path =\u003e \"NUL\"\n    type =\u003e \"order-service\"\n  }\n\n  file {\n    path =\u003e \"C:/path/to/logs/PRODUCT-SERVICE.log\"\n    start_position =\u003e \"beginning\"\n    sincedb_path =\u003e \"NUL\"\n    type =\u003e \"product-service\"\n  }\n}\n\nfilter {\n  if [type] == \"customer-service\" {\n    json {\n      source =\u003e \"message\"\n    }\n    mutate {\n      add_field =\u003e { \"service_name\" =\u003e \"CUSTOMER-SERVICE\" }\n    }\n  }\n\n  if [type] == \"order-service\" {\n    json {\n      source =\u003e \"message\"\n    }\n    mutate {\n      add_field =\u003e { \"service_name\" =\u003e \"ORDER-SERVICE\" }\n    }\n  }\n\n  if [type] == \"product-service\" {\n    json {\n      source =\u003e \"message\"\n    }\n    mutate {\n      add_field =\u003e { \"service_name\" =\u003e \"PRODUCT-SERVICE\" }\n    }\n  }\n}\n\noutput {\n  elasticsearch {\n    hosts =\u003e [\"http://localhost:9200\"]\n    index =\u003e \"%{type}-logs\"\n  }\n  stdout { codec =\u003e rubydebug }\n}\n\n```\n## Step 3: Start logstash:\n* Put copy of `logstash.conf` file in `logstash` folder, `./bin` folder and `./config` folder\n* Start logstash by running the command: `./bin/logstash -f logstash.conf`\n\n## Step 4: Run All Microservice Application and view log\n* Start all microservice application, It will create logs on the specified directory file.\n* View Logs in Kibana\n  1. Go to `http://localhost:5601` to open Kibana.\n  2. In Kibana, create an index pattern for the logs. Go to `Management` \u003e `Index Patterns`, and create a new index pattern matching your Logstash indices (e.g., `microservice-logs-*`).\n  3. Once the index pattern is created, you can search, visualize, and analyze the logs using Kibana's Discover and Visualize tools.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehedi32hstu%2Fspring-boot-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmehedi32hstu%2Fspring-boot-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehedi32hstu%2Fspring-boot-microservice/lists"}