In a distributed application, we can use centralized logging, which provides a complete stack trace for a microservice-based application. To do this, you can use Elasticsearch, Logstash, and Kibana (ELK). In another of our books, Mastering Spring Boot 2.0, there is a complete practical example of how to implement centralized logging with ELK, and in this section we will provide you with an introduction to ELK. Take a look at the following diagram:
As you can see in the preceding diagram, we have successfully used ELK. The three open-source projects that make up ELK are as follows:
Elasticsearch: Elasticsearch is an enterprise-grade search and analytics engine that can be widely distributed. It's an open-source search engine and is readily scalable. Elasticsearch can power extremely fast searches that support your data, provide analytical and statistic-based results, and support your data discovery applications.
Logstash: Logstash is a server-side data processing pipeline that takes in data through multiple sources and, at the same time, powers it, converts it, and then sends it to a stash such as Elasticsearch. Logstash supports a variety of different forms of input and pulls in events from different sources simultaneously. It can take in information from your metrics, web applications, logs, data stores, and different AWS services, all of which stream without a hitch.
Kibana: Kibana is a web interface that is used to search and view logs that Logstash has indexed. Kibana is also based on Elasticsearch. It's an open-source visualization platform that helps you visualize your data in a variety of charts, tables, and maps.