本文介绍了弹簧靴和ELK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列使用Spring Boot构建的微服务,它们作为带有docker-compose的docker容器运行。我想集中日志文件,因此考虑使用ELK(在另一个容器中运行)。如何将日志文件从基于Spring Boot的Docker容器中获取到ELK,它们是从容器中推送到ELK还是反之?

I have a series of microservices built using Spring Boot running as docker containers with docker-compose. I want to centralise log files so I'm thinking of using ELK (running in another container). How do I get the log files from the Spring Boot based docker containers to ELK, are they pushed from the containers to ELK or vice versa?

任何示例配置或最新库将不胜感激。

Any example configuration or recent libraries would be much appreciated.

推荐答案

您可以使用以下架构,

Spring boot application- -> Kafka-> ELK

Spring boot application --> Kafka --> ELK

对于此体系结构,
1.在Log4j xml文件上配置Kafka附加程序。然后,日志将自动推送到Kafka主题。
2.将Log-stash配置配置为Kafka主题上的订户。
3.您还可以在Log-stash上使用任何过滤器。

For this architecture,1. Configure a Kafka appender on Log4j xml file. Then, logs are automatically pushed to a Kafka topic.2. Configure Log-stash configuration as a subscriber on Kafka topic.3. As well as you can use any filters on Log-stash.

ref:

这篇关于弹簧靴和ELK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 18:53