add 完成 ELK 整合
parent
93e52ae6ac
commit
fae0df1905
@ -0,0 +1 @@
|
||||
ES 数据目录 请执行 `chmod 777 /docker/elk/elasticsearch/data` 赋予读写权限 否则 ES 将无法写入数据
|
@ -0,0 +1 @@
|
||||
ES 插件目录 扩展插件可以放入此目录下
|
@ -0,0 +1,14 @@
|
||||
input {
|
||||
tcp {
|
||||
mode => "server"
|
||||
host => "0.0.0.0"
|
||||
port => 4560
|
||||
codec => json_lines
|
||||
}
|
||||
}
|
||||
output {
|
||||
elasticsearch {
|
||||
hosts => "127.0.0.1:9200"
|
||||
index => "%{[spring.application.name]}-%{+YYYY.MM.dd}"
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-common-logstash</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-logstash logstash日志推送模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<included>
|
||||
|
||||
<springProperty scope="context" name="appName" source="spring.application.name"/>
|
||||
|
||||
<!--输出到logstash的appender-->
|
||||
<appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!--可以访问的logstash日志收集端口-->
|
||||
<destination>${logstash.address}</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<customFields>{"spring.application.name":"${appName}"}</customFields>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="logstash"/>
|
||||
</root>
|
||||
</included>
|
@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<!-- kafka-appender properties -->
|
||||
<springProperty name="KAFKA_BOOTSTRAP_SERVERS" source="logging.extend.kafka-appender.bootstrap-servers"
|
||||
defaultValue="127.0.0.1:9092"/>
|
||||
<springProperty name="KAFKA_TOPIC" source="logging.extend.kafka-appender.topic"
|
||||
defaultValue="logback_to_logstash"/>
|
||||
|
||||
<appender name="KAFKA" class="com.github.danielwegener.logback.kafka.KafkaAppender">
|
||||
<encoder>
|
||||
<!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%p|${APPLICATION_NAME:-seata-server}|${RPC_PORT:-0}|%t|%logger|%X{X-TX-XID:-}|%X{X-TX-BRANCH-ID:-}|%m|%wex</pattern>-->
|
||||
<pattern>{
|
||||
"@timestamp": "%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"level":"%p",
|
||||
"app_name":"${APPLICATION_NAME:-seata-server}",
|
||||
"PORT": ${RPC_PORT:-0},
|
||||
"thread_name": "%t",
|
||||
"logger_name": "%logger",
|
||||
"X-TX-XID": "%X{X-TX-XID:-}",
|
||||
"X-TX-BRANCH-ID": "%X{X-TX-BRANCH-ID:-}",
|
||||
"message": "%m",
|
||||
"stack_trace": "%wex"
|
||||
}
|
||||
</pattern>
|
||||
</encoder>
|
||||
<topic>${KAFKA_TOPIC}</topic>
|
||||
<keyingStrategy class="com.github.danielwegener.logback.kafka.keying.NoKeyKeyingStrategy"/>
|
||||
<deliveryStrategy class="com.github.danielwegener.logback.kafka.delivery.AsynchronousDeliveryStrategy"/>
|
||||
<producerConfig>bootstrap.servers=${KAFKA_BOOTSTRAP_SERVERS}</producerConfig>
|
||||
<producerConfig>acks=0</producerConfig>
|
||||
<producerConfig>linger.ms=1000</producerConfig>
|
||||
<producerConfig>max.block.ms=0</producerConfig>
|
||||
</appender>
|
||||
</included>
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<!-- logstash-appender properties -->
|
||||
<springProperty name="LOGSTASH_DESTINATION" source="logging.extend.logstash-appender.destination"
|
||||
defaultValue="127.0.0.1:4560"/>
|
||||
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- the TCP address of the logstash -->
|
||||
<destination>${LOGSTASH_DESTINATION}</destination>
|
||||
|
||||
<!--<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">-->
|
||||
<encoder charset="UTF-8" class="io.seata.server.logging.logback.appender.EnhancedLogstashEncoder">
|
||||
<!-- the global custom fields -->
|
||||
<customFields>
|
||||
{
|
||||
"app_name": "${APPLICATION_NAME:-seata-server}"
|
||||
}
|
||||
</customFields>
|
||||
|
||||
<!-- Exclude the provider of data `@version` -->
|
||||
<excludeProvider>net.logstash.logback.composite.LogstashVersionJsonProvider</excludeProvider>
|
||||
<!-- Exclude providers that are not currently needed, reduce some performance loss. -->
|
||||
<excludeProvider>net.logstash.logback.composite.loggingevent.JsonMessageJsonProvider</excludeProvider>
|
||||
<excludeProvider>net.logstash.logback.composite.loggingevent.TagsJsonProvider</excludeProvider>
|
||||
<excludeProvider>net.logstash.logback.composite.loggingevent.LogstashMarkersJsonProvider</excludeProvider>
|
||||
<excludeProvider>net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider</excludeProvider>
|
||||
</encoder>
|
||||
</appender>
|
||||
</included>
|
Loading…
Reference in New Issue