十台机器逐台登上去 grep,是反模式的。日志集中采集,检索才成为可能。
操作步骤
# filebeat.yml
filebeat.inputs:
- type: log
paths: ["/var/log/myapp/*.log"]
output.elasticsearch:
hosts: ["https://log.internal:9200"]
要点速览
- agent 在各机采集,统一发往 ES/Loki 等存储。
- 加统一字段(服务名/环境),检索能跨机关联。
- 集中后保留策略统一,旧日志自动清理。
日志聚合把「登十台机器」变成「一次查询」。