您的位置:首页 > 汽车 > 时评 > ELK优化之Filebeat部署

ELK优化之Filebeat部署

2024/10/5 14:06:46 来源:https://blog.csdn.net/2402_83805984/article/details/140208583  浏览:    关键词:ELK优化之Filebeat部署

目录

1.安装配置Nginx

2.安装 Filebeat

3.设置 filebeat 的主配置文件

4.修改Logstash配置

5.启动配置

6.kibana验证

主机名ip地址主要软件
es01192.168.9.114ElasticSearch
es02192.168.9.115ElasticSearch
es03192.168.9.116ElasticSearch、Kibana
nginx01192.168.9.113nginx、Logstash
NA192.168.9.111nginx、Filebeat

初始化操作,所有服务器操作
systemctl disable --now firewalld
setenforce 0
vim /etc/selinux/config
SELINUX=disabled

1.安装配置Nginx

cd /etc/yum.repos.d/
上传nginx.repo文件
yum install -y nginx
systemctl enable --now nginx
cd /usr/share/nginx/html#准备测试页面
echo '<h1>this is web page</h1>' > test.html
echo '<h1>this is web2 page</h1>' > test1.html

2.安装 Filebeat

上传软件包 filebeat-6.7.2-linux-x86_64.tar.gz 到/opt目录
tar xf filebeat-6.7.2-linux-x86_64.tar.gz
mv filebeat-6.7.2-linux-x86_64 /usr/local/filebeat

3.设置 filebeat 的主配置文件

cd /usr/local/filebeat
cp filebeat.yml filebeat.yml.bak
vim filebeat.yml
filebeat.inputs:
- type: log         #指定 log 类型,从日志文件中读取消息enabled: true     #24行paths:- /var/log/nginx/access.log       #28行指定监控的日志文件- /var/log/nginx/error.logtags: ["filebeat"]		#设置索引标签fields:           #46行可以使用 fields 配置选项设置一些参数字段添加到 output 中service_name: nginxlog_from: 192.168.9.111--------------output-------------------
(全部注释掉)----------------Logstash output---------------------
output.logstash:    #162行hosts: ["192.168.9.113:5044"]      #164行指定 logstash 的 IP 和端口

4.修改Logstash配置

cd /etc/logstash/conf.d
vim filebeat.conf
input {beats {port => "5044"}
}#filter {}output {elasticsearch {hosts => ["192.168.9.114:9200", "192.168.9.115:9200", "192.168.9.116:9200"]index => "nginx-%{+yyyy.MM.dd}"}}logstash -t -f filebeat.conf  #检查文件


5.启动配置

192.168.9.111

#启动 filebeat
 ./filebeat -e -c filebeat.yml
#-e:输出到标准输出,禁用syslog/文件输出
#-c:指定配置文件

192.168.9.113

#启动 logstash

logstash -f filebeat.conf

6.kibana验证



版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com