一: filebeat安装
1.下载解压filebeat
curl -L -Ohttps://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.0.0-linux-x86_64.tar.gz
tar xzvf filebeat-8.0.0-linux-x86_64.tar.gz
2.修改配置文件
cd filebeat-8.0.0-linux-x86_64/
2.1配置日志文件地址
2.2输出kafka
3.启动filebeat
nohup ./filebeat -e -c filebeat-kafka.yml> filebeat.log &
tar解压的不能用上面方式启动,关闭窗口会停止服务,需要设置系统服务
4.设置filebeat为系统服务
1. vim/lib/systemd/system/filebeat.service
2.
[Unit]
Description=filebeat
Wants=network-online.target
After=network-online.target
[Service]
User=dev
ExecStart=/data/soft/filebeat-8.0.0-linux-x86_64/filebeat-e -c /data/soft/filebeat-8.0.0-linux-x86_64/filebeat-kafka.yml
Restart=always
[Install]
WantedBy=multi-user.target
3. systemctlstart filebeat
二: logstash安装
1.下载解压
https://www.elastic.co/cn/downloads/logstash
tar xzvf logstash-8.0.0-linux-x86_64.tar.gz
2.修改配置文件
cd logstash-8.0.0/
2.1 配置kafka接收topic
2.2 配置过滤规则
2.3 配置kafka输出topic
3.启动logstash
nohup bin/logstash -fconfig/logstash-kafka.conf --config.reload.automatic > logstash.log &