国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 網絡通信 > 正文

Cisco IOS Cookbook 中文精簡版第十八章日志

2019-11-04 23:56:39
字體:
來源:轉載
供稿:網友

18.1.  啟用本地路由器日志

提問 實現路由器自身保存日志記錄,而不僅僅是顯示在終端上

回答

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#logging buffered informational

Router(config)#end

Router#

注釋 缺省日志記錄為debugging級別,例子中為informational忽略掉了debug消息。禁用使用下面命令

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no logging buffered

Router(config)#end

Router#

 

18.2.  設定日志記錄大小

提問 改變路由器保存日志記錄的大小

回答

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#logging buffered 16000

Router(config)#end

Router#

注釋 要注重的是改變了大小后,原有的日志記錄會被清除。

18.3.  清除路由器日志記錄

提問 清除路由器日志記錄

回答

Router#clear logging

Clear logging buffer [confirm]<enter>

Router#

注釋 無

18.4.  發送日志到屏幕顯示

提問 在終端屏幕實時顯示日志記錄

回答

啟用

Router#terminal monitor

Router#

禁用

Router#terminal no monitor

Router#

注釋 缺省情況下日志記錄只會在console端顯示,要在VTY會話顯示就必須使用上述命令

18.5.  使用遠端日志服務器

提問 發送日志記錄到遠端日志服務器

回答

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#logging 172.25.1.1

Router(config)#end

Router#

12.2(15)T后也可以使用下面命令格式


Router2#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router2(config)#logging host 172.25.1.1

Router2(config)#end

Router2#

注釋 在12.2(15)T后增加了一個特性可以使發送的記錄中包含了主機名,下面這是原始的日志記錄

Jul 15 20:35:07 172.25.1.100: Jul 15 20:35:07.499 EDT: %SYS-5-CONFIG_I: Configured from console by ijbrown on vty0 (172.25.1.1)

下面這個是使用特性后的記錄

Jul 15 20:37:05 172.25.1.100: Router2: Jul 15 20:37:05.173 EDT: %SYS-5-CONFIG_I: Configured from console by ijbrown on vty0 (172.25.1.1)

配置方法:Router2#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router2(config)#logging origin-id hostname

Router2(config)#end

Router2#

18.6.  Unix服務器上啟用Syslog服務

提問 配置Unix服務器接收syslog記錄

回答

一般只需要在/etc/syslog.conf

local7.info                                     /var/log/rtrlog

注釋 缺省情況路由器使用local7 logging facility

18.7.  修改缺省Log Facility

提問 修改缺省Log Facility

回答

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#logging host 172.25.1.1

Router(config)#logging facility local6

Router(config)#end

Router#

注釋 無

18.8.  限制特定日志記錄發送至服務器

提問 限制特定等級的日志記錄發送至服務器

回答

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#logging host 172.25.1.1

Router(config)#logging trap notifications

Router(config)#end

Router#

注釋 無

18.9.  設定Syslog消息的源地址


提問 路由器Syslog消息的源地址使用特定地址

回答

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#logging host 172.25.1.1

Router(config)#logging source-interface Loopback0

Router(config)#end

Router#

注釋 這樣假如在日志服務器上設置了地址翻譯就可以實現下述的效果

APR  2 20:27:01 172.25.2.6 94: %SYS-5-CONFIG_I: Configured from on vty0

Apr  2 20:27:48 Boston 95: %SYS-5-CONFIG_I: Configured from on vty0

18.10.  記錄路由器日志記錄到不同的文件

注釋 略

18.11.  維護服務器上的日志記錄

注釋 使用腳本實現日志記錄的自動存檔等功能 略

18.12.  測試日志服務器的配置

注釋 使用腳本來測試日志服務器的配置是否正確 略

18.13.  避免常見的消息被記錄

提問 在日志記錄中禁止一些常見的端口狀態等消息

回答

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#interface Serial0/0

Router(config-if)#no logging event link-status

Router(config-if)#no logging event dlci-status-change

Router(config-if)#no logging event subif-link-status

Router(config-if)#exit

Router(config)#end

Router#

注釋 略

18.14.  日志記錄的流量控制

提問 限制發送到服務器的日志流量

回答

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#logging host 172.25.1.1

Router(config)#logging rate-limit 30 except warnings

Router(config)#end

Router#

對控制臺口的日志記錄數目控制

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#logging rate-limit console 25 except warnings

Router(config)#end

Router#

注釋 無

18.15.  啟用日志統計


提問 統計路由器日志的類型和數目

回答

Router2#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router2(config)#logging count

Router2(config)#end

Router2#

注釋

Router2#show logging count

Facility       Message Name                     Sev Occur      Last Time

==================================================================================

NTP            PEERREACH                          6    3 Jul 13 20:31:34.441      

NTP            PEERSYNC                           5    1 Jul 13 20:23:03.571      

NTP            PEERUNREACH                        4    3 Jul 13 20:22:00.435      

NTP            RESTART                            6    1 Jan 31 14:13:33.769      

-------------  -------------------------------  ----------------------------------

NTP TOTAL                                              8

 

18.16.  生成xml格式的日志記錄

提問 以XML格式來發送日志

回答

Router2# configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.


Router2(config)#logging console xml

Router2(config)#logging monitor xml

Router2(config)#logging buffered xml

Router2(config)#logging host 172.25.1.1 xml

Router2(config)#end

Router2#

注釋 12.2(15)T引入此特性,方便后處理

<!--[if !supportLists]-->18.17.       <!--[endif]-->修改日志記錄

提問 希望修改系統日志記錄的一些屬性

回答

首先要寫特定的TCL腳本(delcounters.tcl 腳本用于過濾掉包含counters的日志)

# delcounters.tcl  This script deletes all log messages that

#                   have the mnemonic "COUNTERS".

if { [string compare -nocase COUNTERS $::mnemonic ] == 0 } {

return ""

} else {

return $::orig_msg

}

然后引用此腳本

Router2#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router2(config)#logging filter tFTP://172.25.1.1/delcounters.tcl

Router2(config)#logging host 172.25.1.1 filtered

Router2(config)#end

Router2#

注釋 Embedded Syslog Manager (ESM) 引自12.3(2)T,提供一個程序化的接口可以對日志進行過濾,修改等全面控制,主要是使用TCL腳本來進行控制。



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 买车| 桂平市| 大庆市| 汨罗市| 射洪县| 呼伦贝尔市| 延川县| 阿鲁科尔沁旗| 英山县| 广平县| 嵊州市| 资中县| 平安县| 平南县| 临高县| 抚宁县| 塔河县| 嘉兴市| 定南县| 忻城县| 扶绥县| 阿鲁科尔沁旗| 申扎县| 中卫市| 灌南县| 隆回县| 柳江县| 宣汉县| 清河县| 西林县| 温州市| 甘德县| 桂东县| 盐山县| 宜城市| 安岳县| 桃江县| 南城县| 渝北区| 沈丘县| 达拉特旗|