logging synchronous
Prevents console and VTY line output from being interrupted by unsolicited system messages, ensuring that command output remains readable.
Definition: logging synchronous is a Cisco IOS line config command. Prevents console and VTY line output from being interrupted by unsolicited system messages, ensuring that command output remains readable.
Overview
The `logging synchronous` command is a Line Configuration mode command used on Cisco IOS devices to prevent unsolicited system messages (such as debug output, syslog messages, or console alerts) from interrupting the user's command input or output on a terminal line. When enabled, the console or VTY line will buffer any incoming system messages and display them only after the user has completed typing a command or after the current output has finished. This ensures that command output remains readable and that the user's typing is not corrupted by interleaved messages.
The networking concept behind this command is the separation of interactive user sessions from background system logging. In a typical network environment, routers and switches generate a constant stream of messages for events like interface state changes, routing protocol updates, or security alerts. Without `logging synchronous`, these messages can appear at any time, potentially overwriting the user's command line or mixing with show command output.
This is particularly problematic during troubleshooting sessions where precise command output is critical. The command is typically applied to console lines (line con 0) and VTY lines (line vty 0 4 or 0 15) to protect both local and remote administrative sessions. Alternatives include using `logging buffered` to store messages in a buffer for later review, or `logging rate-limit` to throttle the frequency of messages.
However, these do not prevent message interleaving during active sessions. `logging synchronous` is often used in conjunction with `exec-timeout` and `privilege level` settings to create a stable administrative environment. Important IOS behavior: The command does not affect the generation of log messages; it only delays their display until the line is idle. The buffered messages are still processed and can be viewed with `show logging`.
There is no impact on the running configuration beyond the line configuration itself. The command is available from global configuration mode by entering line configuration mode first. It requires privilege level 15 (enable mode) to configure.
The command is saved in the running configuration and can be written to startup configuration with `copy running-config startup-config`. For VTY lines, it is especially important to enable `logging synchronous` to prevent SSH or Telnet sessions from becoming unusable due to message flooding. In summary, `logging synchronous` is a simple yet essential command for maintaining a clean and usable command-line interface during network operations and troubleshooting.
logging synchronousWhen to Use This Command
- When configuring a router via console and frequent syslog messages disrupt your typing
- During troubleshooting where you need to see clean command output without interleaved log messages
- In production environments where multiple administrators are logged in and generating syslog traffic
- When using Telnet/SSH and want to avoid message corruption of command output
Command Examples
Enable logging synchronous on console line
Router(config)# line console 0
Router(config-line)# logging synchronousRouter(config-line)# *Mar 1 00:05:23.123: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up Router(config-line)#
The command is entered without any immediate output. The next line shows a syslog message that would have interrupted typing, but with logging synchronous enabled, the prompt is redisplayed after the message, keeping your command entry intact.
Verify logging synchronous configuration
Router# show running-config | include line con 0|logging synchronousline con 0 logging synchronous
The output confirms that logging synchronous is configured under line con 0. The 'show running-config' command filters to show only the relevant lines.
Understanding the Output
The 'logging synchronous' command itself produces no direct output when entered. Its effect is observed during operation: when a syslog message is generated while you are typing a command, the message is displayed, and then the command line you were typing is automatically re-displayed. This prevents the message from corrupting your input.
To verify the configuration, use 'show running-config' and look for 'logging synchronous' under the line configuration (e.g., line con 0, line vty 0 4). If present, the feature is active. There are no 'good' or 'bad' values; it is either enabled or disabled.
Watch for missing 'logging synchronous' on console or VTY lines if users report interrupted command entry.
Configuration Scenarios
Enable logging synchronous on console line to prevent message interruption during local administration
A network engineer frequently uses the console port to configure a router. Unsolicited syslog messages (e.g., interface flapping) often interrupt command typing, causing errors and frustration. The goal is to suppress these interruptions while still capturing logs.
Topology
Router (Console) --- PC with terminal emulatorSteps
- 1.Step 1: Enter global configuration mode: Router> enable
- 2.Step 2: Enter global configuration mode: Router# configure terminal
- 3.Step 3: Enter line configuration mode for console: Router(config)# line console 0
- 4.Step 4: Enable logging synchronous: Router(config-line)# logging synchronous
- 5.Step 5: (Optional) Set a timeout for the line: Router(config-line)# exec-timeout 5 0
- 6.Step 6: Exit configuration mode: Router(config-line)# end
- 7.Step 7: Verify the configuration: Router# show running-config | section line con 0
! Enable logging synchronous on console line Router(config)# line console 0 Router(config-line)# logging synchronous Router(config-line)# end
Verify: Use `show running-config | include line con 0` or `show running-config | section line con 0`. Expected output should include `logging synchronous` under the line console 0 section. Also, test by generating a syslog message (e.g., shut/no shut an interface) while typing a command; the message should appear after you press Enter.
Watch out: If you forget to exit line configuration mode before testing, the command may not take effect until you exit. Also, `logging synchronous` does not affect messages that are already being displayed; it only prevents new messages from interrupting input.
Enable logging synchronous on VTY lines for remote SSH sessions
Remote administrators connect via SSH to manage routers. Debug output from routing protocols or SNMP traps can corrupt the terminal display, making it hard to read command output. The goal is to ensure a clean remote session.
Topology
Admin PC --- (Internet) --- Router (VTY lines 0 4)Steps
- 1.Step 1: Enter global configuration mode: Router> enable
- 2.Step 2: Enter global configuration mode: Router# configure terminal
- 3.Step 3: Enter line configuration mode for VTY lines: Router(config)# line vty 0 4
- 4.Step 4: Enable logging synchronous: Router(config-line)# logging synchronous
- 5.Step 5: (Optional) Set exec-timeout: Router(config-line)# exec-timeout 10 0
- 6.Step 6: Exit configuration mode: Router(config-line)# end
- 7.Step 7: Verify the configuration: Router# show running-config | section line vty
! Enable logging synchronous on VTY lines 0-4 Router(config)# line vty 0 4 Router(config-line)# logging synchronous Router(config-line)# end
Verify: Use `show running-config | section line vty`. Expected output should include `logging synchronous` under the line vty 0 4 section. To test, enable debug on a protocol (e.g., `debug ip ospf events`) and then SSH into the router; debug messages should not appear until you press Enter after a command.
Watch out: If you apply `logging synchronous` only to VTY lines but not to the console, console sessions remain unprotected. Also, if you have multiple VTY line groups (e.g., vty 0 4 and vty 5 15), you must configure each group separately. A common mistake is to forget the `line vty` command and apply it globally, which is invalid.
Troubleshooting with This Command
When troubleshooting issues related to terminal line interruptions, the `logging synchronous` command is a primary tool to ensure that command output is not corrupted by unsolicited messages. Healthy output after enabling `logging synchronous` means that when you type a command, no system messages appear until you press Enter. If you see messages interleaved with your typing, the command may not be enabled on that line, or the line may be configured incorrectly.
To verify, use `show running-config | section line` to check for `logging synchronous` under the relevant line (console or vty). If it is present but messages still interrupt, check if the line is being used by another session (e.g., multiple VTY sessions) – the command applies per line, not per session. Another common symptom is that after enabling `logging synchronous`, you notice that messages are delayed and then appear in a burst when you press Enter.
This is normal behavior; the messages are buffered and displayed when the line becomes idle. However, if messages are lost or not appearing at all, check the logging buffer size with `show logging`. The `logging synchronous` command does not affect the logging buffer; it only delays display.
If you need to see messages immediately, you may need to disable `logging synchronous` temporarily. For diagnostic flow: 1) Identify the line experiencing issues (console or VTY). 2) Enter line configuration mode for that line. 3) Ensure `logging synchronous` is enabled. 4) If not, enable it. 5) Test by generating a syslog message (e.g., shut/no shut an interface) while typing a command. 6) If messages still interrupt, check for other line settings like `logging on` (global) or `terminal monitor` (which forces debug output to the terminal). The `terminal monitor` command can override `logging synchronous` because it sends debug output directly to the terminal.
To prevent this, either disable `terminal monitor` or use `no debug all` to stop debug output. Additionally, correlate with `show logging` to see if messages are being generated. If the router is generating many messages, consider using `logging rate-limit` to reduce the flood.
In summary, `logging synchronous` is a first-line defense against message interruption, but it must be combined with proper logging configuration and session management for effective troubleshooting.
CCNA Exam Tips
CCNA exam tip: Remember that 'logging synchronous' is configured under line configuration mode, not global config.
CCNA exam tip: It only affects the line it is configured on (console, aux, or VTY).
CCNA exam tip: This command does not stop syslog messages; it just re-displays your input after the message.
CCNA exam tip: Often tested alongside 'exec-timeout' and 'logging console' for line configuration scenarios.
Common Mistakes
Mistake 1: Configuring 'logging synchronous' under global configuration mode instead of line configuration mode — the command will be rejected.
Mistake 2: Forgetting to apply it to VTY lines when only console is configured — remote users still experience interruptions.
Mistake 3: Assuming it suppresses syslog messages — it only re-displays your input, messages still appear.
logging synchronous vs line vty 0 4
Although both commands relate to terminal line behavior, 'logging synchronous' operates within line configuration mode to suppress disruptive syslog messages, while 'line vty 0 4' is the global command to enter that mode. They are often confused because logging synchronous is typically applied after entering line configuration via the 'line vty' command.
| Aspect | logging synchronous | line vty 0 4 |
|---|---|---|
| Scope | Applies to current line (e.g., console, VTY) | Defines which VTY lines to configure (0-4) |
| Configuration mode | Line configuration mode | Global configuration mode |
| Persistence | Part of line configuration, saved with config | Global command; subsequent line config persists independently |
| Precedence | Affects output display on that line only | Does not affect output; enables entering line config |
| Typical use | Prevent syslog messages from interrupting typing | Start configuring VTY lines for remote access |
Use logging synchronous when you want to prevent unsolicited console or VTY messages from corrupting command output while typing.
Use line vty 0 4 when you need to enter line configuration mode to set parameters like authentication, ACLs, or exec timeout on the first five VTY lines.
Platform Notes
In IOS-XE (e.g., Catalyst 9000 switches, ISR 4000 series), the `logging synchronous` command behaves identically to classic IOS. The syntax and output are the same. However, in IOS-XE, there is also the `logging synchronous` command under the `line` configuration mode, with no additional parameters.
In NX-OS (Cisco Nexus switches), the equivalent command is `logging synchronous` under line configuration mode as well, but NX-OS uses a different CLI structure. For example, on Nexus 9000, you enter `configure terminal`, then `line console` or `line vty`, and then `logging synchronous`. The behavior is similar: it prevents unsolicited messages from interrupting input.
However, NX-OS also has a `terminal monitor` command that can override this. On Cisco ASA (Adaptive Security Appliance), the command is `logging synchronous` under `line` configuration mode as well, but ASA uses a different CLI (similar to IOS). For IOS-XR (e.g., ASR 9000, CRS), the command is not available in the same form.
IOS-XR uses a different terminal line management system; instead, you can use `terminal monitor` to control debug output, but there is no direct equivalent to `logging synchronous`. In IOS-XR, you can use `terminal length 0` to avoid paging, but message interleaving is handled differently. For IOS versions, the command has been available since at least IOS 12.0 and remains unchanged in 15.x and 16.x.
There are no syntax differences between versions. The command is always applied per line and does not have any parameters. It is important to note that on some older IOS versions, the command might be listed as `logging synchronous` with no additional options.
Always verify with `?` in line configuration mode.
Related Commands
exec-timeout [min] [sec]
Sets the inactivity timeout for an EXEC session on a line, automatically logging out idle users to free up resources and enhance security.
line vty 0 4
Enters line configuration mode for virtual terminal (VTY) lines 0 through 4 to configure remote access settings like Telnet/SSH, ACLs, and timeout parameters.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions