在CentOS上部署和配置Filebeat时,遵循以下最佳实践可以帮助您确保系统的高效性和可靠性:
filebeat.yml
文件,配置输入(inputs)和输出(outputs)。例如,配置日志文件路径、Elasticsearch主机等。./filebeat -e -c filebeat.yml
sudo systemctl daemon-reload
sudo systemctl enable filebeat.service
sudo systemctl start filebeat.service
multiline.pattern: '\['
multiline.negate: true
multiline.match: after
multiline.max_lines: 10000
json.keys_under_root: true
json.overwrite_keys: true
json.message_key: log
json.add_error_key: true
queue.type: persisted
queue.max_bytes: 1024mb
flush.min_events: 2048
flush.timeout: 1s
filestream
输入类型,它比老旧的log
输入类型更高效。close_inactive
参数、优化multiline配置、增大 queue.max_bytes
值。通过遵循这些最佳实践,您可以确保Filebeat在CentOS上高效、稳定地运行,同时优化其性能和资源使用。