在Debian上安全运行Filebeat需要考虑多个方面,包括配置文件的安全性、使用安全的认证方式、限制网络访问、定期更新和监控等。以下是一些关键步骤和建议:
cd /home/filebeat
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.10.1-linux-x86_64.tar.gz
tar -xvf filebeat-7.10.1-linux-x86_64.tar.gz
cd filebeat-7.10.1-linux-x86_64
/home/filebeat/filebeat-7.10.1-linux-x86_64/filebeat.yml
):add_host_metadata
、add_cloud_metadata
等,以增强日志的上下文信息。output.elasticsearch:
hosts:
- "elasticsearch-secure:9200"
username: "elastic"
password: "your_secure_password"
ssl.enabled: true
ssl.certificate: "/path/to/your/certificate.pem"
ssl.key: "/path/to/your/key.pem"
cat /etc/systemd/system/filebeat.service
# ...
systemctl enable filebeat
systemctl start filebeat
以下是一个参考配置示例,展示了如何在配置文件中设置一些基本的安全选项:
filebeat.inputs:
- type: log
enabled: true
paths:
- /logs/apps/prod/*.log
filebeat.config.modules:
path: {path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 1
setup.kibana:
host: "kibana-secure:5601"
output.elasticsearch:
hosts:
- "elasticsearch-secure:9200"
username: "elastic"
password: "your_secure_password"
ssl.enabled: true
ssl.certificate: "/path/to/your/certificate.pem"
ssl.key: "/path/to/your/key.pem"
processors:
- add_host_metadata:
when.not.contains.tags: forwarded
- add_cloud_metadata:
通过以上步骤和建议,可以在Debian上安全地运行Filebeat,并确保其日志收集和传输过程的安全性。