ELK收集交换机日志-创新互联
1、环境介绍
交换机:华为、思科、H3C
Elasticsearch版本:7.13.3
kibana版本:v 7.13.3
logstash版本:7.17.8
2、ES集群配置
参考:
https://blog.csdn.net/zyj81092211/article/details/118935274
3、kibana配置
参考
https://blog.csdn.net/zyj81092211/article/details/118967979
4、logstash配置
安装key
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
添加软件源,编辑logstash.repo文件添加如下
[logstash-7.x]
name=Elastic repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
安装logstash
yum install logstash
编辑systemd启动文件,更改为root用户(端口号小于1000的程序,普通用户会因为权限问题不能启动,这里改成root用户启动)
vi /etc/systemd/system/logstash.service
5、编辑logstash交换机配置文件
配置文件放到目录/etc/logstash/conf.d/
vi /etc/logstash/conf.d/switch.conf
添加如下
input{syslog {type =>"HUAWEI"
port =>514
}
syslog {type =>"CISCO"
port =>5002
}
syslog {type =>"H3C"
port =>5003
}
}
output{stdout {#将日志输出到当前终端上显示
codec =>rubydebug
}
#同时也发送到elasticsearch
elasticsearch {index =>"switch-syslog-%{+YYYY.MM}"
user =>elastic
password =>"Smtgbk_123"
hosts =>["esdn01.wtown.com:9200"]
}
}
6、启动logstash
systemctl start logstash
systemctl enable logstash
7、华为交换机配置外置日志中心
info-center loghost source Vlanif1
info-center loghost 10.99.50.123
info-center enable
8、H3C交换机配置外置日志中心
info-center loghost source Vlan-interface1
info-center loghost 10.99.50.123 port 5003
9、思科交换机配置外置日志中心
enable
configure terminal
logging host 10.99.50.123 transport tcp port 5002
logging on
logging trap 7
logging facility local5
logging source-interface Loopback 0 //这里改成交换机地址所在端口
service timestamps log datetime localtime
10、Edge ES浏览器插件
11、配置kibana
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
分享题目:ELK收集交换机日志-创新互联
文章源于:http://azwzsj.com/article/deocjh.html