(转)标准设置
Router(config)#service timestamps debug datetime msec localtime
#使用本地时间(精确到毫秒)标记DEBUG信息
Router(config)#service timestamps log datetime msec localtime
#使用本地时间(精确到毫秒)标记日志信息
Example:
Router(config)#service timestamps debug datetime msec localtime
Router(config)#service timestamps log datetime msec localtime
显示时区是设置
有些时候Cisco 交换机的日志显示是X年X周的格式(如1y21w),怎么样设置才可以让Log显示年月日和时间
siwtch(config)#service timestamps debug datetime msec localtime show-timezone
siwtch(config)#service timestamps log datetime msec localtime show-timezone
年的设置需要研究
配置PIX设备
Logging on 在PIX上面启用日志记录
Snmp-server community gsunion 为PIX设备配置共同体串gsunion
Snmp-server enable traps 配置PIX设备将SNMP消息发送到网管服务器
Snmp-server host server-ip 在PIX设备上面配置SNMP网管服务器
Logging history warning
为PIX设备SNMP系统日志消息设置warning级别。
设置IOS设备
在IOS的Enable状态下,敲入
config terminal 进入全局配置状态
Cdp run 启用CDP
snmp-server community gsunion ro 配置本路由器的只读字串为gsunion
snmp-server community gsunion rw 配置本路由器的读写字串为gsunion
snmp-server enable traps 允许路由器将所有类型SNMP Trap发送出去
snmp-server host IP-address-server traps trapcomm 指定路由器SNMP Trap的接收者为10.238.18.17,发送Trap时采用trapcomm作为字串
snmp-server trap-source loopback0 将loopback接口的IP地址作为SNMP Trap的发送源地址
logging on 起动log机制
logging IP-address-server 将log记录发送到10.238.18.17 (CW2K安装机器的IP地址)上的syslog server
logging facility local7 将记录事件类型定义为local7
logging trap warning 将记录事件严重级别定义为从warningl开始,一直到最紧急级别的事件全部记录到前边指定的syslog server.
logging source-interface loopback0 指定记录事件的发送源地址为loopback0的IP地址
service timestamps log datetime 发送记录事件的时候包含时间标记
enable password ******
line tty 0 4
password ******
login local 设置Enable口令和Telnet口令
show running
copy running start或write terminal 显示并检查配置
保存配置
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
进行以上操作之后,系统就可以在相应的文件中记录日志信息了。