filebeat+redis+logstash将日志写入文件

filebeat客户端配置文件--

filebeat.prospectors:
- type: log
  harvester_limit: 12
  close_inactive: 35m
  paths: ["/opt/app/log/*.log"]
  #exclude_lines: [ "disconected from"]
  multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
  multiline.match: after
  multiline.negate: true
output:
  redis:
    hosts: ["61.148.68.110"]
    port: 6877
    password: "kxxd123@#"
    key: "Online:log"
    data_type: "list"


logstash配置文件:

input {
  redis{
    host => ["127.0.0.1"]
    port => 6379
    password => "kxxd123@#"
    key => "Online:log"
    data_type => "list"
    add_field => {"id" => "online"} 
  }
}
output {
  if [id] == "online"{
    file {
      path => "./online/%{source}"#只能写相对路径。。。。
      codec => line{ format => "%{message}"}
    }
  }
}


猜你喜欢

转载自blog.51cto.com/302876016/2331602
今日推荐