本文共 2216 字,大约阅读时间需要 7 分钟。
https://github.com/kmtong/logback-redis-appender
例 98.1. spring boot logback
root@netkiller /etc/logstash/conf.d % cat spring-boot-redis.conf input { redis { codec => json host => "localhost" port => 6379 key => "logstash:redis" data_type => "list" }}output { elasticsearch { hosts => ["127.0.0.1:9200"] index => "logstash-api" }}
src/main/resources/logback.xml
neo@MacBook-Pro ~/deployment % cat api.netkiller.cn/src/main/resources/logback.xml%date{yyyy-MM-dd HH:mm:ss} %-4relative [%thread] %-5level %logger{35} : %msg %n
例 98.2. Elasticsearch 索引切割示例
root@netkiller /opt/api.netkiller.cn % cat /etc/logstash/conf.d/spring-boot-redis.conf input { redis { codec => json host => "localhost" port => 6379 db => 10 key => "logstash:redis" data_type => "list" }}output { stdout { codec => rubydebug } elasticsearch { hosts => ["127.0.0.1:9200"] index => "logstash-%{type}-%{+YYYY.MM.dd}" }}
%date{yyyy-MM-dd HH:mm:ss} %-4relative [%thread] %-5level %logger{35} : %msg %n
原文出处:Netkiller 系列 手札
本文作者:陈景峯 转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。