配置Cisco ASA 5500 系統日誌

 查看系統日誌是專業的網路管理者必做的功課,因為透過查看系統日誌可以幫助你分析及查明問題的原因;並可以事先進行防範。在Cisco ASA上有許多設定系統日誌的方法,找一個你喜歡的方式開始進行監控吧。

 

 

ciscoasa(config)# logging enable //啟用系統日誌功能 
ciscoasa(config)# logging debug-trace //系統日誌包括debug的訊息 
INFO: ‘logging debug-trace’ is enabled. All debug messages are currently being redirected to syslog and will not appear in any monitor session

ciscoasa(config)# logging emblem //系統日誌使用EMBLEM 格式 
ciscoasa(config)# logging timestamp //發送出來的系統日誌要有日期欄位 


 

 

ciscoasa(config)# logging list Web***_Errors level errors class web***

//指定要送出的事件訊息,這樣所試範的為:只有關於Web***相關「class web***  的錯誤訊息「level errors」, 當然你也可以自行定義所需的系統日誌

 

 

//指定要如何將事件訊息傳送出去,你可以按照需要把不同的日誌發到不同的地方

 

Internal Buffer – 發送到Pix/ASA設備中的緩存區。

優點:不需要藉助任何軟件和硬件,日誌就存在設備本身中。 
缺點:緩衝區的大小受硬件限制,默認為4K bytes。一旦超過設定大  小就會覆蓋之前的日誌。(可以把寫滿的日誌發到FTP服務器上來避免被覆蓋) 
命令:logging buffered [severity_level] 
範例:

ciscoasa(config)# logging flash-bufferwrap 
ciscoasa(config)# logging flash-maximum-allocation 2000 
ciscoasa(config)# logging flash-minimum-free 4000

 

Syslog message server  – 發送到Syslog 服務器

優點:可以存儲大量的日誌文件,利於翻查歷史日誌。 
缺點:需要syslog服務器來收集syslog message。 
命令:logging host [interface_name] [tcp[/port] | udp[/port]]  (預設為UDP 514) 
          logging trap [severity_level] 
範例:

ciscoasa(config)# logging trap  Web***_Errors

 

Email  – 發送到指定的郵件地址

優點:及時把日誌發送到郵件。如果有黑莓的話,隨時隨地都可以收到。 
缺點:需要SMTP服務器來轉發郵件。 
命令:logging mail [severity_level] 
          logging receipient-address [email_address] 
          logging from-address [email_address] 
          smtp-server [ip_address] 
範例:

ciscoasa(config)# logging mail Web***_Errors 
ciscoasa(config)# logging from-address [email protected] //設定寄件者 
ciscoasa(config)# logging recipient-address [email protected] level errors

 

Console – 發送到控制檯

優點:實時。不需要其他軟硬件的支持。 
缺點:需要物理上連接到控制口,而且無法保存。當網絡流量大的時候,開啟這項會影響性能。 
命令:logging console [severity_level] 
範例:

ciscoasa(config)# logging console Web***_Errors

 

Telnet/SSH Session  – 發送到Telnet/SSH 虛擬終端

優點:實時。不需物理上連接到設備。 
缺點:無法保存。 
命令:logging monitor [severity_level] 
          terminal monitor 
範例:

ciscoasa(config)# logging monitor Web***_Errors

 

ASDM – 發送到Pix/ASA圖形化管理界面

優點:實時。在圖像界面下實現過濾等功能更為簡便。 
缺點:無法保存。 
命令:logging asdm [severity_level]

範例:

ciscoasa(config)# logging asdm Web***_Errors

 

SNMP server – 發送到SNMP服務器

優點:可以存儲大量的日誌文件,利於翻查歷史日誌。 
缺點:需要SNMP服務器來收集snmp trap。 
命令:logging history [severity_level] 
          snmp-server host [if_name] [ip_address] 
          snmp-server location [text] 
          snmp-server contact [text] 
          snmp-server community [key] 
          snmp-server enable traps

範例:

ciscoasa(config)# logging history Web***_Errors 

 

實例說明:將日誌文件送至Syslog Server

ciscoasa(config)# logging trap  Web***_Errors //指定要送出的事件訊息。


 

 

ciscoasa(config)# logging host inside 192.168.0.10 format emblem //設定連接的Log Server ,連結埠為UDP 514,輸出格式為EMBLEM


ciscoasa(config)# logging host inside 192.168.0.11 6/1470 secure //設定第二的Syslog Server ,連結埠為TCP 1470,並使用SSL加密方式輸出。

 

WARNING: A secure logging connection can only be established with a
         SSL/TLS capable syslog server. If a SSL/TLS connection cannot 
         be established, all new connections will be denied. 
         This default behavior may be changed by enabling logging 
         permit-hostdown. 

 

 

設定要輸出的訊息 
ciscoasa(config)# logging trap  Web***_Errors //自訂輸出的

ciscoasa(config)# logging trap  debugging //7級以上的

ciscoasa(config)# logging permit-hostdown

 

 

實例說明:將日誌文件送至E-mail

 

設定用Mail 輸出訊息 
ciscoasa(config)# logging mail Web***_Errors 
ciscoasa(config)# logging from-address [email protected] //設定寄件者 
ciscoasa(config)# logging recipient-address [email protected] level errors //設定收件者

 

 

ciscoasa(config)# smtp-server 192.168.0.10 192.168.0.20 //設定SMTP Server

 

 

 

實例說明:將訊息先存在flash再轉存至FTP

ciscoasa(config)# logging flash-bufferwrap //啟用flash儲存功能
WARNING: Enabling the logging flash-bufferwrap feature could cause a 
         depletion of all available memory under high syslog 
         rates. Please adjust your buffered logging level 
         appropriately 
ciscoasa(config)# logging flash-maximum-allocation 2000 
ciscoasa(config)# logging flash-minimum-free 4000

 

ciscoasa(config)# logging ftp-bufferwrap //啟用FTP儲存功能
WARNING: Enabling the logging ftp-bufferwrap feature could cause a 
         depletion of all available memory under high syslog 
         rates. Please adjust your buffered logging level 
         appropriately 
ciscoasa(config)# logging ftp-server 192.168.0.10 . cisco P@ssw0rd //設定FTP Server IP,帳號及密碼。

 

參考資料:

ciscoasa# sh logging //查看logging 設定

Cisco日誌等級一共分為8級,0級最高,7級最低。具體劃分如下:

Emergency (severity 0)—The system is unusable 
Alert (severity 1)—Immediate action is needed 
Critical (severity 2)—Critical condition 
Error (severity 3)—Error condition 
Warning (severity 4)—Warning condition 
Notification (severity 5)—Normal but significant condition 
Informational (severity 6)—Informational message 
Debugging (severity 7)—Debugging message

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章