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

您所在的位置:网站首页 华为交换机配置日志记录 配置华为交换机把日志发送到远程centos syslog服务器上

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

2024-06-22 22:04| 来源: 网络整理| 查看: 265

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")



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3