I don’t get asked about this quite so much since the Cisco CCNA added this to the curriculum but there are some people who may not have been paying attention (or learned by shortcut) and this is for them. In fact, there is more detail here about the terminal monitoring than you really wanted to know.
Logging to your Terminal
By default, Cisco IOS does not send log messages to a terminal session over IP, that is, telnet or SSH connections don’t get log messages. Console connections on a serial cable do have logging enabled by default.
Syntax
If you don’t understand the difference between Console, Terminal and Monitor then you should read
this article which discusses it in detail.
Check your current logging
You can see the current logging status by using the ‘show logging’ command on this switch I have handy:
s1#sh logging
Syslog logging: enabled (0 messages dropped, 0 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)
No Active Message Discriminator.
No Inactive Message Discriminator.
Console logging: level debugging, 1002228 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 1 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 1002228 messages logged, xml disabled,
filtering disabled
Exception Logging: size (4096 bytes)
Count and timestamp logging messages: disabled
File logging: disabled
Persistent logging: disabled
No active filter modules.
Trap logging: level informational, 1002230 message lines logged
Log Buffer (4096 bytes)
--Snip--
Yeah, well, I lied about about be able to see it. IOS doesn’t actually tell you that the default condition is doing anything. This is how Cisco IOS does everything, the default doesn’t show up((This rule applies everywhere, except where it doesnít.)). Get over it.
By default the console always gets log messages, so nothing shows in the logging output above. By default the terminal doesnít show log messages and so nothing shows int the logging output above.
Using “terminal monitor”
If you want logging messages from IOS to appear on the your terminal then you need to use the ‘terminal monitor‘ command. You can type it long hand if you like, but everyone shortens this to ‘term mon‘ and in conversation it’s said ‘term mon‘ (as in, “go term mon now will you?”).
s1#
s1#term mon
That’s it. Logging to your terminal will now occur. Of course, a message or log has to be happening for a message to appear. So lets use IOS to tell us that we have configured it.
Turning Terminal Logging Off
In a classic moment of IOS madness, if you want to stop logging to your terminal:
s1#terminal no monitor
If is was consistent with everything in IOS, you might expect to use:
s1#no terminal monitor †But you would be wrong. This syntax is very old and predates the more standardised IOS conventions.
Confirming that logging is enabled to your terminal
s1#sh logg
Syslog logging: enabled (0 messages dropped, 0 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)
No Active Message Discriminator.
No Inactive Message Discriminator.
Console logging: level debugging, 1002247 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 1 messages logged, xml disabled,
filtering disabled
Logging to: vty1(0)
Buffer logging: level debugging, 1002247 messages logged, xml disabled,
filtering disabled
Exception Logging: size (4096 bytes)
Count and timestamp logging messages: disabled
File logging: disabled
Persistent logging: disabled
No active filter modules.
Trap logging: level informational, 1002249 message lines logged
Log Buffer (4096 bytes):
Which leads to the question – Which terminal am I on ?
Use show terminal to find out which line your on, and this is teh same number as the vty:
s1#sh terminal
Line 2, Location: "", Type: "LINUX"
Length: 62 lines, Width: 161 columns
Baud rate (TX/RX) is 9600/9600
Status: PSI Enabled, Ready, Active, No Exit Banner, Ctrl-c Enabled
Automore On
Capabilities: none
In this case, you would be on vty2.
Other posts in the series
- Cisco IOS CLI Regex: sh ip bgp in
- IOS CLI Tip: More accurate pipe commands
- Cisco Nexus NXOS and Fixing broken “switchto” syntax with alias
- show ip eigrp topology all
- Cisco IOS CLI Shortcuts
- The poor man's IOS Traffic Generator
- IOS: "terminal monitor" on, off - logging to your terminal (This post)
- IOS: Console, Terminal, Monitor, VTY - what is what ?
- IOS: Clearing an interface configuration
- IOS: Setting Terminal Window Length
- IOS CLI: show run linenum
- IOS: Setting the TCP timeout on IOS
- IOS: enable and .... disable ?
- IOS: Reverse SSH console access - Part 2
- IOS:Open Source Lab DNS and IP addressing
- IOS: Reverse SSH console access
- ip tcp timestamp
- Cisco ASA and IOS command tip - test aaa-server
