This project aims to showcase 2 key features of a microservices application. The first is distributed tracing. The second is the implementation of a centralised log management system. This application has been developed using Spring Boot
I am using Spring Cloud Sleuth for distributed tracing and Zipkin for visualisation.
Spring is logging using Slf4j with Logback configured to write to Logstash. Logstash is writing to Elasticsearch. Kinana is used to visualise the logs
Follow these steps:
- Build the Spring application
> ./mvnw install
- Start the infrastructure
> docker-compose up
- Start service 1
> ./mvnw spring-boot:run -Dspring.application.name=upstream -Dserver.port=8081 -Ddownstream.server.url=http://localhost:8082
- Start service 2
> ./mvnw spring-boot:run -Dspring.application.name=middle -Dserver.port=8082 -Ddownstream.server.url=http://localhost:8083
- Start service 3
> ./mvnw spring-boot:run -Dspring.application.name=downstream -Dserver.port=8083
- Call the rest endpoing a few times.
> curl localhost:8081/zipkin
upstream -> middle -> downstream
- Open Kibana http://localhost:5601/
- Under "Management" create an Index Pattern.
logstash-*
and@timestamp
- Choose "Discover" to view the log entries
NB. If you want to filter on a particular trace you can use something similar to this
message: ">>> Call*" AND traceId: "7f3a243d1b53720f"
- Open Zipkin http://localhost:9411/
- Choose "Find Traces"