標籤:華為 交換器 log 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")
配置華為交換器把日誌發送到遠程centos syslog伺服器上