2 September 2010

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.

Please rate this post:

1 Star - It\\\'s Crud2 Stars - It\\\'s Tosh3 Stars - Something\\\'s missing4 Stars - Needs works5 Stars - Good Enough6 Stars - Good7 Stars - Excellent8 Stars - Brilliant9 Stars - Astonishing10 Stars - Awesomely Godlike? (No Ratings Yet)
Loading ... Loading ...

About Greg Ferro
Greg is a Network and Security Architect / Designer / Engineer working freelance in the UK and worked for Resellers, DotCom's, Large Corporate's and Service Providers across a variety of products & Vendors. He prefers to work for end users, believes in the life cycle, total cost of ownership and that near enough is often good enough. He likes talking about himself in the first person to feel "royal", even when hosting the Packet Pushers Podcast on Data Networking. More about Greg at http://etherealmind.com/who-am-i/ and you can follow him on Twitter.

Comments

  1. DaveC says:

    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

Speak Your Mind

*