ELK + Filebeat 5.4.1配置
本文档简单介绍如何配置ELK三大组件和Filebeat的流程
版本: 当前开发(测试)和生产环境各组件都是基于 5.4.1 版本。由于ELK组件之间存在版本依赖关系,更新任一组件(如要更新 elasticsearch 至最新稳定版XXX)都需要同时更新其他的相关组件。
环境说明:
系统版本: Centos 7.X
Java版本:java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
ELK软件:
elasticsearch-5.4.1.rpm
logstash-5.4.1.rpm
kibana-5.4.1-x86_64.rpm
x-pack-5.4.1.zip
filebeat-5.4.1-x86_64.rpm
部署流程:
1、安装配置elasticsearch和x-pack
rpm -ivh elasticsearch-5.4.1.rpm
/usr/share/elasticsearch/bin/elasticsearch-plugin install file:///data/soft/x-pack-5.4.1.zip
systemctl enable elasticsearch
--修改配置文件--
systemctl start elasticsearch
2、安装logstash(不用每个节点都安装,只要一个即可)
ks-log-s2: rpm -ivh logstash-5.4.1.rpm
systemctl enable logstash
--修改配置文件--
systemctl start logstash
3、安装kibana(不用每个节点都安装,只要一个即可)
ks-log-s1: rpm -ivh kibana-5.4.1-x86_64.rpm
/usr/share/kibana/bin/kibana-plugin installfile:///data/soft/x-pack-5.4.1.zip
--修改配置文件--
systemctl enable kibana
systemctl start kibana
4、安装filebeat
每个服务节点安装,并配置log文件的绝对路径(filebeat支持在配置文件中模糊匹配log文件名,可以视情况进行配置)
client:rpm -ivh filebeat-5.4.1-x86_64.rpm
--修改配置文件--
systemctl enable filebeat
systemctl start filebeat
5、配置nginx
直接在proxy_pass后面填写“http://1.1.1.1:5601”可能会有问题,浏览器会报告页面跳转太多,而用域名或者主机名亦或upstream的形式来配置即没有这个问题。
logview server : openresty
upstream elk {
server 10.9.143.224:5601;
}
server {
listen 80;
server_name log.elklog.com;
access_log off;
location / {
proxy_pass http://elk;
}
location = /favicon.ico {
log_not_found off;
}
}
PSPS:
filebeat 模糊匹配:
在paths段:
paths:
- /data/docker/logs/qa/psps/*/*.log (- /data/docker/logs/qa/psps/*/psps-*.log)