filebeat+redis+logstash將日誌寫入檔案
阿新 • • 發佈:2018-12-17
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: "[email protected]#" key: "Online:log" data_type: "list"
logstash配置檔案:
input { redis{ host => ["127.0.0.1"] port => 6379 password => "[email protected]#" key => "Online:log" data_type => "list" add_field => {"id" => "online"} } } output { if [id] == "online"{ file { path => "./online/%{source}"#只能寫相對路徑。。。。 codec => line{ format => "%{message}"} } } }