使用ELK Stack + Kafka/Redis收集Logback日志

在pom.xml添加依赖(logging-appender可在github中拉取代码自己构建)


        org.redisson
        redisson
        3.2.3
    
    
        org.apache.kafka
        kafka-clients
        0.10.1.1
        provided
    
    
        net.myscloud.plugin
        logging-appender
        1.0-SNAPSHOT
    

logback.xml添加Appender


        
            
                127.0.0.1:6379
                redis-log
            
        
        
        test-application
    

    
        
            
                127.0.0.1:9092
                topic1
            
        
        
        test-application
    

日志格式

{
        "@timestamp": "2017-01-17T10:40:53.129+0800",
        "host": "10.2.85.49",
        "level": "WARN",
        "logger": "net.myscloud.plugin.logging.logback.redis.appender.LogbackRedisAppenderTest",
        "message": "test87",
        "source": "test-application",
        "thread": "main"
    }

 

Github地址 https://github.com/jxttian/logging-appender

转载于:https://my.oschina.net/u/2321575/blog/871729

你可能感兴趣的:(使用ELK Stack + Kafka/Redis收集Logback日志)