mirror of
https://github.com/gnu4cn/ccna60d.git
synced 2024-05-21 04:55:00 +08:00
Daily update. 2018-06-07 15:18:56
This commit is contained in:
@@ -43,6 +43,8 @@
|
||||
|
||||
下表40.1中列出并介绍了思科IOS设备所设置的值(请记住这些严查程度级别与它们的名称):
|
||||
|
||||
*表 40.1 - 思科IOS软件`syslog`的优先级分级与定义*
|
||||
|
||||
| 严重程度级别 | 严查程度级别名称 | `syslog`的定义 | 介绍 |
|
||||
| :---: | :---: | :---: | :--- |
|
||||
| `0` | 紧急(Emergencies) | `LOG_EMERG` | 此级别用于那些将导致系统不可用的最严重的错误情景。 |
|
||||
@@ -54,4 +56,73 @@
|
||||
| `6` | 消息(Informational) | `LOG_INFO` | 此级别用于表示有关系统正常运行的消息。 |
|
||||
| `7` | 调试(Debugging) | `LOG_DEBUG` | 此级别用于表示通常用于故障排除目的的实时的(调试的)信息。 |
|
||||
|
||||
在`syslog`中,设施(the facility)用于表示生成消息的源。源可以是某个本地设备上的进程、应用,或者甚至操作系统本身。设施是以数字(整数)表示的。在思科IOS软件中,有八个本地使用设施可由进程及应用(以及设备本身)用于发送`syslog`消息。默认思科IOS设备使用设施`local7`来发送`syslog`报文。但要注意大多数思科设备提供了改变默认设施级别的选项。在思科IOS软件中,可使用全局配置命令`loggin facility [facility]`来指定`syslog`的设施。该命令可用的选项如下所示:
|
||||
|
||||
```sh
|
||||
R1(config)#logging facility ?
|
||||
auth Authorization system
|
||||
cron Cron/at facility
|
||||
daemon System daemons
|
||||
kern Kernel
|
||||
local0 Local use
|
||||
local1 Local use
|
||||
local2 Local use
|
||||
local3 Local use
|
||||
local4 Local use
|
||||
local5 Local use
|
||||
local6 Local use
|
||||
local7 Local use
|
||||
lpr Line printer system
|
||||
mail Mail system
|
||||
news USENET news
|
||||
sys10 System use
|
||||
sys11 System use
|
||||
sys12 System use
|
||||
sys13 System use
|
||||
sys14 System use
|
||||
sys9 System use
|
||||
syslog Syslog itself
|
||||
user User process
|
||||
uucp Unix-to-Unix copy system
|
||||
```
|
||||
|
||||
要通过`syslog`来发送消息,就必须在设备上执行以下顺序的步骤:
|
||||
|
||||
1. 使用`logging on`配置命令在路由器或交换机上全局性开启日志记录功能。默认在思科IOS软件中,日志记录是开启的;但仅开启了将消息发送到控制台。对于要将消息发到除控制台外的其它任何目的地,`logging on`命令都是强制要求的。
|
||||
|
||||
2. 使用全局配置命令`logging trap [severity]`,指定出要发送到`syslog`服务器的消息的严重程度。可使用数字或使用等价的严重性名称,来指定发送消息的严重程度。
|
||||
|
||||
3. 使用全局配置命令`logging [address]`或`logging host [address]`,指定一个或多个的`syslog`服务器目的地址。
|
||||
|
||||
4. 作为可选项,使用`logging source-interface [name]`指定在`syslog`报文中的源IP地址。在有着配置的多个接口的设备上,这是普遍的做法。乳未指定此命令,则`syslog`报文将包含路由器或交换机用于抵达服务器的接口的IP地址。而在出于冗余目的有着多个接口时,该地址就会在主要路径(接口)宕掉时发生改变。因此,通常将其设置为某个环回接口。
|
||||
|
||||
下面的配置实例,演示了如何将所有信息(informational(level6))及以下的报文,发送到一台有着IP地址`192.168.1.254`的`syslog`服务器:
|
||||
|
||||
```sh
|
||||
R2(config)#logging on
|
||||
R2(config)#logging trap informational
|
||||
R2(config)#logging 192.168.1.254
|
||||
```
|
||||
|
||||
此配置可使用`show syslog`命令进行验证,如下所示:
|
||||
|
||||
```sh
|
||||
R2#show logging
|
||||
Syslog logging: enabled (11 messages dropped, 1 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)
|
||||
Console logging: disabled
|
||||
Monitor logging: level debugging, 0 messages logged, xml disabled,filtering disabled
|
||||
Buffer logging: disabled, xml disabled, filtering disabled
|
||||
Logging Exception size (4096 bytes)
|
||||
Count and timestamp logging messages: disabled
|
||||
No active filter modules.
|
||||
Trap logging: level informational, 33 message lines logged
|
||||
Logging to 192.168.1.254(global) (udp port 514, audit disabled, link up), 2 message lines logged, xml disabled, filtering disabled
|
||||
```
|
||||
|
||||
一般在配置日志记录时,重要的是要确保路由器或交换机的时钟反映的是真实的当前时间,这可实现与错误数据的关联。日志消息上的不准确或不正确时间戳,会令到使用过滤或关联流程,来做错误与问题隔离十分困难,并十分耗时。在思科IOS软件中,系统时钟可手动配置,或者将设备配置为自动将其时钟与网络时间协议服务器进行同步。在后面的小节将对这两种方法进行讨论。在网络中仅有少数互联网络设备时,手动的时钟或时间配置没有问题。在思科IOS软件中,系统时间是通过使用`clock set hh:mm:ss [day & month | month & day] [year]`特权`EXEC`命令进行配置的。其不是在全局配置模式下配置或指定的。下面的配置示例,演示了如何将系统时钟设置为 2010 年 10 月 20 日上午12:15:
|
||||
|
||||
```sh
|
||||
R2#clock set 12:15:00 20 october 2010
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user