1. filebeat命令详解
2. 配置filebeat接收日志文件,发送至logstash处理,需要先运行logstash,再运行filebeat
./filebeat -e -c xxx.yml -d "publish"
3. filebeat 多服务器实例配置
- 参考方案:
(1)在所有要从中收集日志的服务器上部署filebeat捕获日志;
(2)将logstash配置为监听TCP端口模式,然后将应用查询日志输出到socket
input {
tcp {
port => 8192
codec => json
tags => [ "micrologs" ]
}
}
# 还有一种相同操作,json_lines编码用于根据传入连接中的json行分析日志事件
input {
tcp {
port => 8192
codec => json_lines
tags => [ "micrologs" ]
}
}
4. 使用FileBeat从远程服务器检索日志文件
5. filebeat接收tcp/udp日志
- 参考方案:filebeat 接收tcp/udp日志
6. filebeat读取日志文件坑:
filebeat默认读取log文件会一次性从头读取所有数据,当读取文件持续更新时,每次从头读取会重复读取以前的历史数据。tail_files配置项只保证第一次读取时从文件末尾开始,不读首行内容