syslog 华为 服务器_配置华为交换机把日志发送到远程centos syslog服务器上

huawei switch:

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

info-center source default channel 2 log level debugging

#指定从哪个接口发送

info-center loghost source Vlanif1

#指定远程syslog服务器ip

info-center loghost x.x.x.x

Centos Server:

vim /etc/rsyslog.conf

#启用udp 514端口监听。

$ModLoad imudp

$UDPServerRun 514

#把来自两个交换机的日志分别放入到指定的log文件中。

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

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

#重启rsyslog服务

service rsyslog restart

测试:

在交换机上执行任何命令都被记录下来,比如:

#tail -f /var/log/switch01.log

May  5 16:17:27 switch01 %%01SHELL/6/DISPLAY_CMDRECORD(s)[1]: Recorded display command information. (Task=VT0, Ip=x.x.x.x, VpnName=, User=**, AuthenticationMethod="Password", Command="display info-center statistics")

May  5 16:17:40 switch01 %%01SHELL/6/DISPLAY_CMDRECORD(s)[2]: Recorded display command information. (Task=VT0, Ip=x.x.x.x, VpnName=, User=**, AuthenticationMethod="Password", Command="display current-configuration")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值