赞
踩
前言
小编的上一篇文章中,详细介绍了ELK的架构、优势与kibana + elasticsearch的部署步骤。
废话不多说,直接上干货——ELK中的logstash、kafka与filebeat的部署。
实战
搭建环境与各主机角色说明。
机器选择:睿江云平台
节点选择:广东G(VPC网络更安全、SSD磁盘性能高)
云主机配置:4核16G(4核8G也支持,但会有延时感)
网络选择:VPC虚拟私有云(VPC网络更安全、高效)
带宽:5M
系统版本:Centos7.6
云主机数量:5
软件版本:ELK 7.4.0、kafka 2.12-2.6.0
首先,下面为部署logstash的步骤。
a.步骤1
登陆logstash节点。ssh 到 192.168.0.6
b.步骤2
cd /opt/
wget https://artifacts.elastic.co/downloads/logstash/logstash-7.4.0.tar.gz
c.步骤3
tar -zxvf logstash-7.4.0.tar.gz
mkdir -p /opt/els/logs/logs
d.步骤4
vi /opt/logstash-7.4.0/config/logstash.yml
path.logs: /opt/els/logs/logs
path.config: /opt/logstash-7.4.0/conf.d/*.conf
xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.username: "elastic"
xpack.monitoring.elasticsearch.password: "123456"
xpack.monitoring.elasticsearch.hosts: ["http://ES-node1:9200","http://ES-node2:9201","http://ES-node3:9202"]
e.步骤5
新建配置文件,配置文件作用为自定义日志格式。
vi /opt/logstash-7.4.0/config/demo.yml
cpp input { beats { port => 5044 type => syslog } } filter{ grok{ match => [ "message","%{TIMESTAMP_ISO8601:timestamp}" ] } date { match => [ "timestamp", "yyyy-MM-dd HH:mm:ss" ] locale => "en" timezone => "+00:00" target => "@timestamp" } mutate{ remove_field => ["host"] remove_field => ["agent"] remove_field => ["ecs"] remove_field => ["tags"] remove_field => ["fields"] remove_field => ["@version"] remove_field => ["input"] remove_field => ["log"] } } output { elasticsearch { hosts => ["http://ES-node1:9200"] user => "elastic" password => "123456" index => "test-log" } }
f.步骤6
chown -R els:els /opt/logstash-7.4.0
g.步骤7
cd /opt/logstash-7.4.0/bin/
nohup ./logstash &
logstash启动成功
部署完logstash,接下来部署kafka,作为日志的中转、存储。以下为部署kafka的步骤。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。