配置华为交换机推送syslog到日志服务器:

1、配置华为交换机

方法一:

配置交换机日志推送到日志主机: eg:日志主机IP地址:10.172.49.1

system-view

info-center channel 6 name loghost1

info-center source default channel loghost1 log state on

info-center loghost source *******

info-center loghost 10.172.49.1 channel loghost1

commit

方法二:

#进入用户视图

system-view

#指定发送消息基本,表示从0-7都发送

info-center source default channel 2 log level debugging

#指定从哪个接口发送

info-center loghost source *******

#指定远程syslog服务器ip

info-center loghost 10.172.49.1

备注:******查询方法:dis cu    查询结果如下

eg:IP对应的三层网络接口为loopback 0,用查询到的数据替换*******

#

interface LoopBack0

description Network_Mgmt

ip address 10.4.114.1 255.255.255.255

#

2、配置日志主机

eg:centos server

vim /etc/rsyslog.conf

#启用udp 514端口监听。

$ModLoad imudp

$UDPServerRun 514

#配置交换机日志保存文件  说明:x.x.x.x为交换机ip

:fromhost-ip,isequal, "x.x.x.x"              /var/log/switch01.log

重启日志配置文件

/bin/systemctl start rsyslog.service

查看配置结果:

display info-center channel 6

display logbuffer

display logfile file-name

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐