aldwindelgado / spring-boot-elk

Log Management (ELK) for Spring Boot application using Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spring-boot-elk

Log Management (ELK) for Spring Boot application

This simple example demonstrates how easy you can enable quite powerful and advanced log management in to your Spring Boot application using Docker.

Stack of frameworks/technologies:

  • Spring Boot
  • Swagger
  • Logback
  • Logstash
  • ElasticSearch
  • Kibana
  • Docker

Prerequisites:

  • docker version 1.10.3
  • docker-compose version 1.6.2
  • JDK8
  • Maven

Start the app

  1. In order to run the application in docker you would need to build a docker image first. This simple maven command will to the trick: mvn clean package docker:build -Dmaven.test.skip=true
    Note: for Mac users it can be more difficult. Make sure that you have Environment variables properly exported. The easiest way to do this is the following command (https://docs.docker.com/machine/reference/env/): eval $(docker-machine env default)
    DOCKER_TLS_VERIFY=1
    DOCKER_HOST=tcp://192.168.99.100:2376; //you can find this value by typing: docker-machine ls
    DOCKER_CERT_PATH=/Users/{user}/.docker/machine/certs

  2. Go to root of the project and run: docker-compose up -d Docker will pull all missing images and start new containers. After a while you would be ready to use the app.

  3. Run: docker ps -a. Find an image "javalogaggregation_web" and check the exposed port (For example 0.0.0.0:32808->8080/tcp). You would be able to access the application by typing the following URL in the browser: http://192.168.99.100:32808/swagger-ui.html#!
    Note: ip address is a docker machine IP address. Here you can play with existing REST API.

  4. In order to configure Kibana you would need to go to:
    http://localhost:5601/ or http://{$DOCKER_HOST_IP}:5601/
    Configure your Kibana and play with your logs.
    Note: For Mac users the port 5601 should be added to Port Forwarding Rules of you Docker Virtual Machine

Stop the app

Simply type: docker-compose down

Security

user/user

About

Log Management (ELK) for Spring Boot application using Docker


Languages

Language:Java 70.1%Language:Shell 17.5%Language:Batchfile 12.4%