IOS: “terminal monitor” on, off – logging to your terminal

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 A Series On The Same Topic

  1. Cisco IOS CLI Regex: sh ip bgp in (2nd May 2012)
  2. IOS CLI Tip: More accurate pipe commands (1st May 2012)
  3. Cisco Nexus NXOS and Fixing broken “switchto” syntax with alias (18th December 2011)
  4. show ip eigrp topology all (22nd May 2011)
  5. Cisco IOS CLI Shortcuts (6th February 2011)
  6. The poor man's IOS Traffic Generator (19th September 2009)
  7. IOS: "terminal monitor" on, off - logging to your terminal (17th September 2009)
  8. IOS: Console, Terminal, Monitor, VTY - what is what ? (16th September 2009)
  9. IOS: Clearing an interface configuration (13th September 2009)
  10. IOS: Setting Terminal Window Length (10th September 2009)
  11. IOS CLI: show run linenum (9th September 2009)
  12. IOS: Setting the TCP timeout on IOS (14th August 2008)
  13. IOS: enable and .... disable ? (20th July 2008)
  14. IOS: Reverse SSH console access - Part 2 (25th June 2008)
  15. IOS:Open Source Lab DNS and IP addressing (2nd June 2008)
  16. IOS: Reverse SSH console access (29th May 2008)
  17. ip tcp timestamp (14th April 2008)
  18. Cisco ASA and IOS command tip - test aaa-server (18th February 2008)
About Greg Ferro

Greg Ferro is a Network Engineer/Architect, mostly focussed on Data Centre, Security Infrastructure, and recently Virtualization. He has over 20 years in IT, in wide range of employers working as a freelance consultant including Finance, Service Providers and Online Companies. He is CCIE#6920 and has a few ideas about the world, but not enough to really count.

He is a host on the Packet Pushers Podcast, blogger at EtherealMind.com and on Twitter @etherealmind and Google Plus

You can contact Greg via the site contact page.

  • DaveC

    Hi Greg,

    Another nice intro article, however a couple i would like to add a couple of quick points your readers may be interested in…

    1) Since writing to the console must occur at it’s configured speed (default 9600 bps) this can cause increased in CPU usage(if it suddenly has to write 000s of messages* at that speed and in each case wait until it has finished witting the last this can cause problems. It is a while since I have seen this on live equipment and am unsure if this is due to better scheduling within IOS. However I would still consider it good practice to disable console logging except for a specific purposes.

    2) While not “better” than the methods above I thought I would mention the way I usually check if the (telnet/shh) session logged in has logging enabled, as an alternative:
    LabR1SW3#sh term | inc Cap
    Capabilities: Receives Logging Output

    For new Cisco users it probably worth pointing out the other useful items in the sh term output as part of your Console Mastery series.

    *e.g. if debugging is enabled

Subscribe For Weekly Updates by Email

Get a Weekly Summary of Latest Articles and Posts to your Email Inbox Every Sunday

Thanks for signing up. Look for the email from MailChimp & make sure you confirm your email address. You may need to check your spam or gmail settings to be sure of receiving the email.

Note: You can unsubscribe at any time using the link at the bottom of every email.