用 Filebeat 进行系统监控的实操指南
一 核心思路与适用场景
二 快速上手步骤
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
- /var/log/syslog
- /var/log/auth.log
ignore_older: 72h
output.logstash:
hosts: ["localhost:5044"]
output.elasticsearch:
hosts: ["localhost:9200"]
username: "elastic"
password: "your_password"
index: "systemlog-%{+YYYY.MM.dd}"
三 关键配置与优化
processors:
- decode_json_fields:
fields: ["message"]
target: ""
四 可视化与告警
五 常见排错与最佳实践