filebeat实现实时采集日志
安装包在官网自行下载,注意版本!
tar -zxvf filebeat-7.13.3-linux-x86_64.tar.gz
cd /home/software/es/filebeat
新建dwp.yml
filebeat.inputs:
- type: log #stdin
enabled: true
paths:
- /home/*.log 日志文件路径
output.console:
pretty: true
enable: true
setup.template.settings:
index.number_of_shards: 3
output.elasticsearch:
hosts: ["139.198.181.54:9200"]
[
output.redis:
hosts: ["139.198.181.54:6379"]
password: 123456
]
前台启动:./filebeat -e -c dwp.yml
-e:控制台输出
-c:指定配置文件
----------------
后台启动后,关闭终端时解决自动关闭问题
sudo chown root filebeat.yml (注意文件名)
后台启动:
nohup /root/filebeat/filebeat -e -c /root/filebeat/filebeat.yml > /dev/null 2>&1 &
查看ps -ef | grep filebeat
退出exit
-----------------
前台启动logstash
./bin/logstash -e 'input { stdin {} } output { stdout { } }'