ELK—filebeat收集单个类型日志写入redis
Filebeat 支持将数据直接写入到 redis 服务器,本步骤为写入到 redis ,另外 filebeat 还支持写入到 elasticsearch、logstash 等服务器。
grep -v "#" /etc/filebeat/filebeat.yml | grep -v "^$" filebeat.prospectors: - input_type: log paths: - /var/log/messages - /var/log/*.log exclude_lines: ["^DBG","^$"] document_type: system-log-1512 output.redis: hosts: ["192.168.15.12:6379"] key: "system-log-1512" #为了后期日志处理,建议自定义 key 名称 db: 1 #使用第几个库 timeout: 5 #超时时间 password: 123456 #redis 密码
配置 logstash 从 redis 读取上面的日志
cat /etc/logstash/conf.d/redis-systemlog-es.conf input { redis { host => "192.168.15.12" port => "6379" db => "1" key => "system-log-1512" data_type => "list" } } output { if [type] == "system-log-1512" { elasticsearch { hosts => ["192.168.15.11:9200"] index => "system-log-1512" } } }
本文来自博客园,作者:不会跳舞的胖子,转载请注明原文链接:https://www.cnblogs.com/rtnb/p/16276339.html