一、ELK架构
二、Filebeat
Filebeat收集各种日志,之后发送到指定目标系统,但是同一时间只能配置一个输出目标。
2.1 Filebeat安装
curl ‐L ‐O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat‐7.13.2‐linux‐
x86_64.tar.gz
tar xzvf filebeat‐7.13.2‐linux‐x86_64.tar.gz ‐C /usr/local/
mv /usr/local/filebeat‐7.13.2‐linux‐x86_64 /usr/local/filebeat
配置sytemd方式的Filebeat启动管理文件
# vim /usr/lib/systemd/system/filebeat.service
[Unit]
Description=Filebeat sends log files to Logstash or directly to Elasticsearch.
Wants=network‐online.target
After=network‐online.target
[Service]
ExecStart=/usr/local/filebeat/filebeat ‐c /usr/local/filebeat/filebeat.yml
Restart=always
[Install]
WantedBy=multi‐user.target
# systemctl daemon‐reload
# systemctl start filebeat 不使用这种方法,使用后台启动
2.2 Filebeat简单使用
创建新文件,在/log/access.log用来测试数据
# vim /tmp/access.log