使用Linux自带rsyslog收集cisco&huawei交换机日志(rsyslog收集网络设备日志)

网友投稿 1488 2022-09-08


使用Linux自带rsyslog收集cisco&huawei交换机日志(rsyslog收集网络设备日志)

修改rsyslog配置

[root@cd-jump rsyslog]# egrep -v "^$|#" /etc/rsyslog.conf

$ModLoad imudp

$UDPServerRun 514

$ModLoad imtcp

$InputTCPServerRun 514

$WorkDirectory /var/lib/rsyslog

$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

$IncludeConfig /etc/rsyslog.d/*.conf

$OmitLocalLogging on

$IMJournalStateFile imjournal.state

*.info;mail.none;authpriv.none;cron.none                /var/log/messages

authpriv.*                                              /var/log/secure

mail.*                                                  -/var/log/maillog

cron.*                                                  /var/log/cron

*.emerg                                                 :omusrmsg:*

uucp,news.crit                                          /var/log/spooler

local7.*                                                /var/log/boot.log

$template host, "/var/lib/rsyslog/%HOSTNAME%.log"

$template ip, "/var/lib/rsyslog/%FROMHOST-IP%.log"

$template msg, "%msg:2:$%\n"

:fromhost-ip, contains, "192.168.192." ?host;msg

思科交换机配置

!

logging facility local4

logging source-interface Vlan1(和rsyslog服务器能通讯的vlan)

logging host 192.168.192.168(rsyslog服务器地址)

logging trap warning

华为交换机配置

sys

info-center enabe

info-center loghost 192.168.192.168 facility local6 transport udp

info-center source shell channel loghost log level notification

Linux客户端配置

[root@gitlab ~]#  egrep -v "^$|#" /etc/rsyslog.conf

$WorkDirectory /var/lib/rsyslog

$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

$IncludeConfig /etc/rsyslog.d/*.conf

$OmitLocalLogging on

$IMJournalStateFile imjournal.state

*.info;mail.none;authpriv.none;cron.none                /var/log/messages

authpriv.*                                              /var/log/secure

mail.*                                                  -/var/log/maillog

cron.*                                                  /var/log/cron

*.emerg                                                 :omusrmsg:*

uucp,news.crit                                          /var/log/spooler

local7.*                                                /var/log/boot.log

*.* @192.168.192.168

最后再配置上日志切割,收工

/var/lib/rsyslog/*.log {

daily

rotate 30

dateext

missingok

nocreate

}


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:在aws上搭建经典3层架构(aws 架构师)
下一篇:如何自动生成接口文档,接口文档生成工具有哪些?
相关文章

 发表评论

暂时没有评论,来抢沙发吧~