華為交換機(jī)怎么發(fā)送日志?
1、配置交換機(jī)
方法一:
配置交換機(jī)日志推送到日志主機(jī): eg:日志主機(jī)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
方法二:
#進(jìn)入用戶(hù)視圖
system-view
#指定發(fā)送消息基本,表示從0-7都發(fā)送
info-center source default channel 2 log level debugging
#指定從哪個(gè)接口發(fā)送
info-center loghost source *******
#指定遠(yuǎn)程syslog服務(wù)器IP
info-center loghost 10.172.49.1
備注:******查詢(xún)方法:dis cu 查詢(xún)結(jié)果如下
eg:IP對(duì)應(yīng)的三層網(wǎng)絡(luò)接口為loopback 0,用查詢(xún)到的數(shù)據(jù)替換*******
#
interface LoopBack0
description Network_Mgmt
ip address 10.4.114.1 255.255.255.255
#
2、配置日志主機(jī)
eg:centos server
vim /etc/rsyslog.conf
#啟用udp 514端口監(jiān)聽(tīng)。
$ModLoad imudp
$UDPServerRun 514
#配置交換機(jī)日志保存文件 說(shuō)明:x.x.x.x為交換機(jī)ip
:fromhost-ip,isequal, "x.x.x.x" /var/log/switch01.log
重啟日志配置文件
/bin/systemctl start rsyslog.service
查看配置結(jié)果:
display info-center channel 6
display logbuffer
display logfile file-name