Problem
You want the router to display log messages to your VTY session in real time.
Solution
Use the terminal monitor command to enable the displaying of log messages to your VTY:
Router#terminal monitor Router#
To disable logging to your VTY session, use the following command:
Router#terminal no monitor Router#
Discussion
Routers forward all logging messages to their console ports by default, but not to their VTY lines. When you are troubleshooting a network problem on a remote router, it is often quite useful to instruct the router to send log messages to your VTY so that you can view them in real time. Here is an example showing how to configure the router to display messages with informational severity level and greater (see Table 18-1 for more information about logging severity levels) to VTY lines:
Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#logging monitor informational Router(config)#exit Router#terminal monitor Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface Fastethernet0/0 Router(config-subif)#shutdown Router(config-subif)#exit Router(config)#end Router# Mar 26 09:36:43: %LINK-5-CHANGED: Interface Fastethernet0/0, changed state to administratively down
This example changes the logging monitor level to informational, enables terminal monitoring and then changes the state of an interface to trigger a sample log message. By default, when you enable VTY displaying of log messages, the terminal monitor severity level is set to debugging, so you will see all messages. Notice that in this example, we have changed the severity level to informational. This will suppress the printing of debug messages, while continuing to display messages with all other severity levels. Keep in mind that setting the severity level for VTY logging is a configuration-based command whereas the command to enable VTY logging, terminal monitor, is a privileged-level command that must be set per session.
Enabling this type of logging makes a Telnet session to a router's VTY port look similar to connecting directly to the router's console port. You can use the show logging command to view the current monitor-logging configuration as follows:
Router>show logging Syslog logging: enabled (0 messages dropped, 101 messages rate-limited, 0 flushes, 0 overruns) Console logging: level debugging, 66712 messages logged Monitor logging: level informational, 65263 messages logged Logging to: vty66(0) Buffer logging: level debugging, 644 messages logged Logging Exception size (4096 bytes) Trap logging: level debugging, 3805 message lines logged Logging to 172.25.1.1, 3805 message lines logged Log Buffer (8000 bytes):
The highlighted section of the output shows that the monitor logging facility has been set to a severity level of informational, and that one session is currently in use, with the messages being displayed on vty66(0):
Router>show users Line User Host(s) Idle Location * 66 vty 0 ijbrown idle 00:00:00 freebsd.oreilly.com 67 vty 1 kdooley idle 00:00:26 solaris.oreilly.com Router>
You can easily determine which user is currently using the monitor logging facility by issuing the show users command. This output indicates that the user ijbrown is currently using the monitor logging facility.
|
This feature is so useful that enabling it will soon become second nature.
Router Configuration and File Management
Router Management
User Access and Privilege Levels
TACACS+
IP Routing
RIP
EIGRP
OSPF
BGP
Frame Relay
Handling Queuing and Congestion
Tunnels and VPNs
Dial Backup
NTP and Time
DLSw
Router Interfaces and Media
Simple Network Management Protocol
Logging
Access-Lists
DHCP
NAT
First Hop Redundancy Protocols
IP Multicast
IP Mobility
IPv6
MPLS
Security
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications
Index