I want to have a quiet command-line such as (config)# no logging console
causes. Still, I want to make use of # debug
commands. It appears to me that # debug
depends on syslog level 7. So I cannot have a quiet CLI and read debug messages at the same time.
Is there a workaround?
Host(config)#logging ?
Hostname or A.B.C.D IP address of the logging host
buffered Set buffered logging parameters
buginf Enable buginf logging for debugging
cns-events Set CNS Event logging level
console Set console logging parameters
count Count every log message and timestamp last occurrence
discriminator Create or modify a message discriminator
dmvpn DMVPN Configuration
esm Set ESM filter restrictions
exception Limit size of exception flush output
facility Facility parameter for syslog messages
filter Specify logging filter
history Configure syslog history table
host Set syslog server IP address and parameters
message-counter Configure log message to include certain counter value
monitor Set terminal line (monitor) logging parameters
on Enable logging to all enabled destinations
origin-id Add origin ID to syslog messages
persistent Set persistent logging parameters
queue-limit Set logger message queue size
rate-limit Set messages per second limit
reload Set reload logging level
server-arp Enable sending ARP requests for syslog servers when first configured
source-interface Specify interface for source address in logging transactions
trap Set syslog server logging level
userinfo Enable logging of user info on privileged mode enabling
Host(config)#logging console ?
<0-7> Logging severity level
alerts Immediate action needed (severity=1)
critical Critical conditions (severity=2)
debugging Debugging messages (severity=7)
discriminator Establish MD-Console association
emergencies System is unusable (severity=0)
errors Error conditions (severity=3)
filtered Enable filtered logging
guaranteed Guarantee console messages
informational Informational messages (severity=6)
notifications Normal but significant conditions (severity=5)
warnings Warning conditions (severity=4)
xml Enable logging in XML
<cr>
An example using cpt_fink's solution:
After logging console critical
and logging buffered 64000 debug
and clear log
on Host
:
Host#show log
Syslog logging: enabled (12 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 critical, 20 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 4 messages logged, xml disabled,
filtering disabled
Logging Exception size (4096 bytes)
Count and timestamp logging messages: disabled
Persistent logging: disabled
No active filter modules.
ESM: 0 messages dropped
Trap logging: level informational, 36 message lines logged
Log Buffer (64000 bytes):
Host#
Host#
Host#debug ip icmp
ICMP packet debugging is on
Host#
Host#
Host#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Host(config)#
Host(config)#interface fastethernet0/1
Host(config-if)#
Host(config-if)#ip address 192.168.0.1 255.255.255.0
Host(config-if)#
Host(config-if)#no shut
Host(config-if)#end
Host#
Host#
Host#show log
Syslog logging: enabled (12 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 critical, 20 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 5 messages logged, xml disabled,
filtering disabled
Logging Exception size (4096 bytes)
Count and timestamp logging messages: disabled
Persistent logging: disabled
No active filter modules.
ESM: 0 messages dropped
Trap logging: level informational, 37 message lines logged
Log Buffer (64000 bytes):
Nov 4 18:03:05.551: %SYS-5-CONFIG_I: Configured from console by console
Host#
Let's provoke one ICMP debug message.
Host_2#ping 192.168.0.1 repeat 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
.
Success rate is 0 percent (0/1)
Host_2#
Host_2#
Host_2#ping 192.168.0.1 repeat 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 12/12/12 ms
Host_2#
Let's look up syslog:
Host#show log
Syslog logging: enabled (12 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 critical, 20 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 6 messages logged, xml disabled,
filtering disabled
Logging Exception size (4096 bytes)
Count and timestamp logging messages: disabled
Persistent logging: disabled
No active filter modules.
ESM: 0 messages dropped
Trap logging: level informational, 37 message lines logged
Log Buffer (64000 bytes):
Nov 4 18:03:05.551: %SYS-5-CONFIG_I: Configured from console by console
Nov 4 18:04:47.527: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Host#
Let's issue commands which usually cause annoying messages:
Host#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Host(config)#
Host(config)#interface fastethernet0/0
Host(config-if)#
Host(config-if)#shut
Host(config-if)#
Host(config-if)#exit
Host(config)#
Host(config)#
Host(config)#interface fastethernet0/1
Host(config-if)#
Host(config-if)#shut
Host(config-if)#
Host(config-if)#exit
Host(config)#
Host(config)#end
Host#
Let's look up syslog:
Host#show log
Syslog logging: enabled (12 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 critical, 20 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 11 messages logged, xml disabled,
filtering disabled
Logging Exception size (4096 bytes)
Count and timestamp logging messages: disabled
Persistent logging: disabled
No active filter modules.
ESM: 0 messages dropped
Trap logging: level informational, 42 message lines logged
Log Buffer (64000 bytes):
Nov 4 18:03:05.551: %SYS-5-CONFIG_I: Configured from console by console
Nov 4 18:04:47.527: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 4 18:11:57.371: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
Nov 4 18:11:58.371: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
Nov 4 18:12:07.619: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down
Nov 4 18:12:08.619: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
Nov 4 18:12:36.111: %SYS-5-CONFIG_I: Configured from console by console
Host#
- What I like: I can work on the CLI without interruptions.
- What I do not like: I still get messages not logged by
debug ip icmp
.
An example using cpt_fink's solution marked as correct answer:
Configuration:
Router_1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router_1(config)#
Router_1(config)#logging console
Router_1(config)#
Router_1(config)#logging console critical
Router_1(config)#
Router_1(config)#logging buffered 64000 debug
Router_1(config)#
Router_1(config)#do clock set 07:29:30 5 november 2014
Router_1(config)#
Router_1(config)#end
Router_1#
Router_1#debug ip icmp
ICMP packet debugging is on
Router_1#
Let's create at least one message:
Router_2#ping 192.168.0.1 repeat 2
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!!
Success rate is 100 percent (2/2), round-trip min/avg/max = 4/4/4 ms
Router_2#
Let's look up syslog:
Router_1#show logging | include ICMP
Nov 5 07:30:05.463: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:30:05.467: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Router_1#
Let's provoke more messages:
Router_2#ping 192.168.0.1 repeat 11
Type escape sequence to abort.
Sending 11, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!!!!!!!!!!!
Success rate is 100 percent (11/11), round-trip min/avg/max = 4/4/4 ms
Router_2#
Let's look up syslog:
Router_1#show logging | include ICMP
Nov 5 07:30:05.463: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:30:05.467: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.807: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.811: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.815: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.819: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.823: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.827: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.831: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.835: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.839: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.843: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Nov 5 07:32:24.847: ICMP: echo reply sent, src 192.168.0.1, dst 192.168.0.2
Router_1#
Best Answer
I would suggest
logging console critical
andlogging buffered 64000 debug
which lets you use thesho log
command to see historical output without clogging the low-speed physical console with messages, while still receiving critical or higher messages on the console.Also useful when using the log buffer are correctly setting your system time (with NTP or
clock set ...
from exec) and timezone/DSTclock timezone XXX -#
andclock summer-time XXX recurring
and using theservice timestamps log datetime local ms
andservice timestamps debug date local ms
commands to mark your messages as they are output.As a side note
terminal monitor
(andterminal no monitor
to disable it) are a way to get immediate output when remotely connected. You can set thelogging monitor [level]
to include debug, or only higher importance messages.