Logging 将日志写入日志文件以及kafka
我目前有microservice环境,每个服务都将日志写入自己的文件。 我想实现分布式日志记录,为此我找到了一个使用elk的解决方案。但我不想干扰我目前将日志写入多个文件的体系结构 是否可以将日志写入文件,然后将其发送到kafka topicLogging 将日志写入日志文件以及kafka,logging,apache-kafka,logback,distributed-system,Logging,Apache Kafka,Logback,Distributed System,我目前有microservice环境,每个服务都将日志写入自己的文件。 我想实现分布式日志记录,为此我找到了一个使用elk的解决方案。但我不想干扰我目前将日志写入多个文件的体系结构 是否可以将日志写入文件,然后将其发送到kafka topic 另外,我目前正在使用log back进行日志记录。更标准的模式是直接将事件从微服务发送到Kafka。从那里,您可以将其流式传输到Elasticsearch和任意数量的其他目标。写入日志然后从日志中读取是完全冗余的 更标准的模式是直接将事件从微服务发送到卡夫
另外,我目前正在使用log back进行日志记录。更标准的模式是直接将事件从微服务发送到Kafka。从那里,您可以将其流式传输到Elasticsearch和任意数量的其他目标。写入日志然后从日志中读取是完全冗余的 更标准的模式是直接将事件从微服务发送到卡夫卡。从那里,您可以将其流式传输到Elasticsearch和任意数量的其他目标。写入日志然后从日志中读取是完全冗余的 您只需在现有配置上添加一个appender,实际上不需要“干扰”您的体系结构 作为一个logback kafka appender,您只需添加到
pom.xml
:
<dependency>
<groupId>com.github.danielwegener</groupId>
<artifactId>logback-kafka-appender</artifactId>
<version>0.2.0</version>
<scope>runtime</scope>
</dependency>
<!-- probably you already have the following or the ones provided by spring, this is an example -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.1.6</version>
<scope>runtime</scope>
</dependency>
如果您查看文档,还可以使用其他appender。您只需在现有配置上添加appender,就不需要“干扰”您的体系结构 作为一个logback kafka appender,您只需添加到
pom.xml
:
<dependency>
<groupId>com.github.danielwegener</groupId>
<artifactId>logback-kafka-appender</artifactId>
<version>0.2.0</version>
<scope>runtime</scope>
</dependency>
<!-- probably you already have the following or the ones provided by spring, this is an example -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.1.6</version>
<scope>runtime</scope>
</dependency>
如果您查看文档,还可以使用其他附件。什么是麋鹿???kibana?@Kaidulk=Elasticsearch,Logstash,kibana。Kibana是Elasticsearch中数据的GUI分析工具。为什么不在容器中使用Filebeat将日志发送到Elastic和Kafka?什么是elk???kibana?@Kaidulk=Elasticsearch,Logstash,kibana。Kibana是Elasticsearch中数据的GUI分析工具。为什么不在容器中使用Filebeat将日志发送到Elastic和Kafka?