test me

Site Search:

How to configure Logging in CISCO IOS

There are 5 types of Cisco routers logs:

  1. Console logging:By default, the router sends all log messages to its console port. Hence only the users that are physically connected to the router console port can view these messages.
  2. Terminal logging:It is similar to console logging, but it displays log messages to the router's VTY lines instead. This is not enabled by default    
  3. Buffered logging:This type of logging uses router's RAM for storing log messages. buffer has a fixed size to ensure that the log will not deplete valuable system memory. The router accomplishes this by deleting old messages from the buffer as new messages are added.
  4. Syslog Server logging :The router can use syslog to forward log messages to external syslog servers for storage. This type of logging is not enabled by default.
  5. SNMP trap logging:The router is able to use SNMP traps to send log messages to an external SNMP server.

Sample router log messages have 7 levels:

0 Emergencies
1 Alerts
2 Critical
3 Errors
4 Warnings
5 Notifications
6 Information
7 Debugging

Configuration Commands

In global configuration mode, you can enable/disable console, buffered and syslog server logging.
You can optionally set the log size for buffered logging. 
When setting up syslog server logging, you need to set the ip of the remote server that collect your syslog. Optionally, you can enables a source interface for the remote syslog server.

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#logging console informational
Router(config)#logging buffered informational
Router(config)#logging trap informational     

Router(config)#logging buffered 64000    (optionally set buffer size for buffered logging)

Router(config)#logging host  (set host ip for syslog server logging)
Router(config)#logging source-interface Loopback0  (Enables a source interface for the remote syslog server)

Router(config)#no logging host  (un-set host ip for syslog server logging)

Router(config)#no logging console
Router(config)#no logging buffered
Router(config)#no logging trap

For terminal logging, use the terminal monitor command in privileged EXEC mode:
Router#terminal monitor 
Router#terminal no monitor

Use the clear logging command to clear the router's internal log buffer:

Router#clear logging 
Clear logging buffer [confirm]<enter>

To display the state of system logging (syslog) and the contents of the standard system logging message buffer, use the show logging command.


No comments:

Post a Comment