设置 Syslog 日志服务器,来获取CISCO和H3C交换机日志
作者:kevin 日期:2010-02-06
注:配置日志服务器前先检查是否已安装了SYSLOG服务需要修改一下/etc/sysconfig/syslog
把文件SYSLOGD_OPTIONS选项后多加一个-r
然后再增加/etc/syslog.conf配制.服务器的配制可以看系统的man syslog
H3C设备配置步骤
<Sysname> system-view
[Sysname] info-center enable
# 指定向日志主机输出日志信息的通道为 loghost 通道。
[Sysname] info-center loghost 1.2.0.1 channel loghost
# 关闭所有模块日志主机的 log、trap、debug 的状态。
[Sysname] info-center source default channel loghost debug state off log state off trap state off
注意:
由于系统对各通道允许输出的系统信息的缺省情况不一样,所以配置前必须将所有模块的需求通道(本例为loghost )上log、trap、debug 状态设为关闭,再根据当前的需求配置输出相应的系统信息。可以用display channel 命令查看通道的状态。
# 将 IP 地址为 1.2.0.1/16 的主机作为日志主机,设置信息级别为informational,输出语言为英文,允许输出信息的模块为所有模块。
[Sysname] info-center loghost 1.2.0.1 facility local7 language english
[Sysname] info-center source default channel loghost log level informational
进行以上操作之后,系统就可以在相应的文件中记录日志信息了。
CISCO交换机的设置举例
以下配置描述了如何将Cisco设备的日志发往syslog服务器
cisco#conf t
cisco(config)#logging on
cisco(config)#logging a.b.c.d //日志服务器的IP地址
cisco(config)#logging facility local1 //facility标识, RFC3164 规定的本地设备标识为 local0 - local7
cisco(config)#logging trap errors //日志记录级别,可用"?"查看详细内容
可选的级别有0-7共八个级别,0最高,7最低。这八个级别分别为:
alerts Immediate action needed (severity=1)
critical Critical conditions (severity=2)
debugging Debugging messages (severity=7)
emergencies System is unusable (severity=0)
errors Error conditions (severity=3)
informational Informational messages (severity=6)
notifications Normal but significant conditions (severity=5)
warnings Warning conditions (severity=4)
(config)#logging on 启用日志服务。
选取最低的debugging级别可以记录所有可以记录的信息,包括系统信息、错误信息、debug信息等等。但是仍然不能满足我们的全部需求。
cisco(config)#logging source-interface e0 //日志发出用的源IP地址
cisco(config)#service timestam log datetime localtime
日志记录的时间戳设置,可根据需要具体配置
检验
cisco#sh logging
把文件SYSLOGD_OPTIONS选项后多加一个-r
然后再增加/etc/syslog.conf配制.服务器的配制可以看系统的man syslog
H3C设备配置步骤
<Sysname> system-view
[Sysname] info-center enable
# 指定向日志主机输出日志信息的通道为 loghost 通道。
[Sysname] info-center loghost 1.2.0.1 channel loghost
# 关闭所有模块日志主机的 log、trap、debug 的状态。
[Sysname] info-center source default channel loghost debug state off log state off trap state off
注意:
由于系统对各通道允许输出的系统信息的缺省情况不一样,所以配置前必须将所有模块的需求通道(本例为loghost )上log、trap、debug 状态设为关闭,再根据当前的需求配置输出相应的系统信息。可以用display channel 命令查看通道的状态。
# 将 IP 地址为 1.2.0.1/16 的主机作为日志主机,设置信息级别为informational,输出语言为英文,允许输出信息的模块为所有模块。
[Sysname] info-center loghost 1.2.0.1 facility local7 language english
[Sysname] info-center source default channel loghost log level informational
进行以上操作之后,系统就可以在相应的文件中记录日志信息了。
CISCO交换机的设置举例
以下配置描述了如何将Cisco设备的日志发往syslog服务器
cisco#conf t
cisco(config)#logging on
cisco(config)#logging a.b.c.d //日志服务器的IP地址
cisco(config)#logging facility local1 //facility标识, RFC3164 规定的本地设备标识为 local0 - local7
cisco(config)#logging trap errors //日志记录级别,可用"?"查看详细内容
可选的级别有0-7共八个级别,0最高,7最低。这八个级别分别为:
alerts Immediate action needed (severity=1)
critical Critical conditions (severity=2)
debugging Debugging messages (severity=7)
emergencies System is unusable (severity=0)
errors Error conditions (severity=3)
informational Informational messages (severity=6)
notifications Normal but significant conditions (severity=5)
warnings Warning conditions (severity=4)
(config)#logging on 启用日志服务。
选取最低的debugging级别可以记录所有可以记录的信息,包括系统信息、错误信息、debug信息等等。但是仍然不能满足我们的全部需求。
cisco(config)#logging source-interface e0 //日志发出用的源IP地址
cisco(config)#service timestam log datetime localtime
日志记录的时间戳设置,可根据需要具体配置
检验
cisco#sh logging
评论: 0 | 引用: 0 | 查看次数: 673
发表评论
上一篇
下一篇


文章来自:
Tags: 
