为了更好的监控网络设备运行装, 搭建了一套日志服务器,环境如下 server:CentOS 6.5 rsyslog client1:cisco 2960 client2:huawei 6730
思科交换机配置
config t
logging on #开启日志功能
logging 192.168.95.5 #日志服务器地址
logging facility local0 #facility标识
logging 192.168.95.5 #日志服务器地址
logging trap 7 (log日志) #日志记录级别
logging source-interface vlan 9 #日志发出用的源IP地址
service timestamps debug datetime localtime #日志记录的时间戳设置
华为交换机配置
info-center enable #开启日志功能
info-center channel 6 name loghost1 #自定义通道名称
info-center loghost source Vlanif92 #日志发出用的源IP地址
info-center loghost 192.168.95.250 channel 6 facility local0 #设置日志服务器地址及发送通道,及facility标识
info-center source default channel loghost1 log level debugging #日志记录级别为所有(默认为此项)
服务器设置
新建一个日志文件
touch cisco.log
修改配置文件
vim /etc/rsyslog.conf
# Provides UDP syslog reception
$ModLoad imudp #打开udp端口
$UDPServerRun 514 #允许接收udp514端口的信息
# Cisco syslog message
local0.* /var/log/cisco.log #配置local0记录位置
SYSLOGD_OPTIONS="-r -x -m 0" #允许服务器接收外来的log日志
保存退出
service rsyslog restart #重启rsyslog服务
查看日志文件是否有日志
[root@vmps log]# cat /var/log/cisco.log
Apr 20 17:16:18 192.168.95.204 18354: Jul 23 20:34:07.510: %VQPCLIENT-7-RECONF: Reconfirming VMPS responses
Apr 20 17:26:18 192.168.95.204 18355: Jul 23 20:44:07.510: %VQPCLIENT-7-RECONF: Reconfirming VMPS responses
Apr 20 17:36:18 192.168.95.204 18356: Jul 23 20:54:07.511: %VQPCLIENT-7-RECONF: Reconfirming VMPS responses