实验:
filebeat 收集日志并发送到logstash
PS : 我好弱啊~
(1)准备
平台:Ubuntu 16.04
filebeat 版本 : 6.3.0 (当前最新)
logstash 版本 : 6.3.0(当前最新)
(2)更改配置
针对 filebeat 中 filebeat.yml
进行配置
此图1的 日志文件 在(3)中配置
(3)添加配置
1. 创建日志文件
创建日志文件 test.log
并 配置下文(内容是从网上copy的)
55.3.244.1 GET /index.html 15824 0.043
55.3.244.1 GET /index.html 15824 0.043
2. 创建并配置logstash配置文件
创建 testLogstash.conf
添加下面
input {
beats {
port => 5044
}
}
output {
stdout {
codec => rubydebug
}
}
(4)运行
sudo bin/logstash -f testLogstash.conf
sudo ./filebeat -e -c filebeat.yml
(5)查错
之前
testLogstash.conf
配置中 将beats
错打成beat
然后报了Failed to connect: dial tcp 127.0.0.1:5044: getsockopt: connection refused
遇到问题可以先去看日志:
然后发现:
意思是:没有
beat
这个插件
(6)参考资料
http://blog.51cto.com/seekerwolf/2106509
https://doc.yonyoucloud.com/doc/logstash-best-practice-cn/input/stdin.html
https://blog.csdn.net/github_39939645/article/details/78896737
https://jimmysong.io/kubernetes-handbook/practice/app-log-collection.html