kafka-appender.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Copyright 1999-2019 Seata.io Group.
  4. ~
  5. ~ Licensed under the Apache License, Version 2.0 (the "License");
  6. ~ you may not use this file except in compliance with the License.
  7. ~ You may obtain a copy of the License at
  8. ~
  9. ~ http://www.apache.org/licenses/LICENSE-2.0
  10. ~
  11. ~ Unless required by applicable law or agreed to in writing, software
  12. ~ distributed under the License is distributed on an "AS IS" BASIS,
  13. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ~ See the License for the specific language governing permissions and
  15. ~ limitations under the License.
  16. -->
  17. <included>
  18. <!-- kafka-appender properties -->
  19. <springProperty name="KAFKA_BOOTSTRAP_SERVERS" source="logging.extend.kafka-appender.bootstrap-servers"
  20. defaultValue="127.0.0.1:9092"/>
  21. <springProperty name="KAFKA_TOPIC" source="logging.extend.kafka-appender.topic"
  22. defaultValue="logback_to_logstash"/>
  23. <appender name="KAFKA" class="com.github.danielwegener.logback.kafka.KafkaAppender">
  24. <encoder>
  25. <!--<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>-->
  26. <pattern>{
  27. "@timestamp": "%d{yyyy-MM-dd HH:mm:ss.SSS}",
  28. "level":"%p",
  29. "app_name":"${APPLICATION_NAME:-seata-server}",
  30. "PORT": ${RPC_PORT:-0},
  31. "thread_name": "%t",
  32. "logger_name": "%logger",
  33. "X-TX-XID": "%X{X-TX-XID:-}",
  34. "X-TX-BRANCH-ID": "%X{X-TX-BRANCH-ID:-}",
  35. "message": "%m",
  36. "stack_trace": "%wex"
  37. }
  38. </pattern>
  39. </encoder>
  40. <topic>${KAFKA_TOPIC}</topic>
  41. <keyingStrategy class="com.github.danielwegener.logback.kafka.keying.NoKeyKeyingStrategy"/>
  42. <deliveryStrategy class="com.github.danielwegener.logback.kafka.delivery.AsynchronousDeliveryStrategy"/>
  43. <producerConfig>bootstrap.servers=${KAFKA_BOOTSTRAP_SERVERS}</producerConfig>
  44. <producerConfig>acks=0</producerConfig>
  45. <producerConfig>linger.ms=1000</producerConfig>
  46. <producerConfig>max.block.ms=0</producerConfig>
  47. </appender>
  48. </included>