<?xml version="1.0" encoding="UTF-8"?>
<included>

    <!-- elk配套日志收集 -->
    <appender name="elk" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${logdir}/${appname}.link.json</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${logdir}/${appname}.link.%d{yyyy-MM-dd}.gz</fileNamePattern>
            <!-- 保存30天 -->
            <maxHistory>30</maxHistory>
        </rollingPolicy>
        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
            <providers>
                <pattern>
                    <pattern>
                        {
                        "log_time": "%date{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}",
                        "severity": "%level",
                        "service": "${appname}",
                        "trace": "%X{traceId:-}",
                        "class": "%logger{40}",
                        "rest": "%message",
                        "thread_name": "%thread",
                        "stack_trace": "%exception{10}"
                        }
                    </pattern>
                </pattern>
            </providers>
        </encoder>
    </appender>
</included>