Syslog (CCNA 200-301 Exam Topic 4.5)
Overview & Purpose
- Concept: Syslog is an industry-standard protocol used for message logging on network devices.
- Details: It records various system events such as interface state changes (up/down), routing protocol neighbor changes (OSPF, EIGRP, BGP), and system restarts.
- Use Case: Essential for system management, historical analysis, and real-time troubleshooting.
graph LR
Device[Network Device] -->|UDP 514| Server[External Syslog Server]
Device --> Console[Console Line]
Device --> Buffer[Device RAM Buffer]
Device --> VTY[VTY Lines Telnet/SSH]
Syslog Message Format
Standard Syslog messages contain specific fields. You must be able to identify these fields on the exam.
- Sequence Number: Indicates the chronological order of messages (Optional/Configurable).
- Timestamp: Exact time the event occurred. Crucial for correlating events across multiple devices using NTP (Optional/Configurable).
- Facility: Indicates which process on the device generated the message (e.g.,
OSPF,LINK,SYS). - Severity: A number (0-7) indicating the seriousness of the event.
- Mnemonic: A short code indicating the specific event type (e.g.,
UPDOWNfor interface changes,ADJCHGfor OSPF adjacency changes). - Description: Detailed human-readable text explaining exactly what happened.
Example Message Breakdown:
*Mar 1 12:00:00.123: %LINK-3-UPDOWN: Interface GigabitEthernet0/0 changed state to up
- Timestamp:
*Mar 1 12:00:00.123 - Facility:
LINK - Severity:
3(Error) - Mnemonic:
UPDOWN - Description:
Interface GigabitEthernet0/0 changed state to up
Syslog Severity Levels
There are 8 severity levels. Level 0 is the most severe, and Level 7 is the least severe.
| Level | Keyword (RFC / Cisco IOS) | Description |
|---|---|---|
| 0 | Emergency | System is unusable. |
| 1 | Alert | Action must be taken immediately. |
| 2 | Critical | Critical conditions. |
| 3 | Error | Error conditions. |
| 4 | Warning | Warning conditions. |
| 5 | Notice / Notification | Normal but significant condition. (Note: RFC uses “Notice”, Cisco IOS uses “Notification”) |
| 6 | Informational | Informational messages. |
| 7 | Debugging | Debugging messages (least severe). |
Mnemonic to remember levels 0-7: Every Awesome Cisco Engineer Will Need Ice cream Daily.
Things to note:
- Severity definitions are subjective and vary by vendor (e.g., Cisco’s “Warning” might differ from Juniper’s “Warning”).
- Crucial Rule: When you configure a specific logging level, the device logs that level AND all higher severity levels (numerically lower). For example, setting the level to
6(Informational) logs levels 0, 1, 2, 3, 4, 5, and 6.
Syslog Destinations & Defaults
Syslog messages can be sent to four primary locations.
| Destination | Default Behavior | Configuration / Notes |
|---|---|---|
| Console Line | Enabled (Levels 0-7) | Displays messages in real-time when physically connected to the console port. |
| Buffer (RAM) | Enabled (Levels 0-7) | Stores messages in device memory. View using show logging. |
| VTY Lines (Telnet/SSH) | Disabled | Must be enabled per session using terminal monitor in Privileged EXEC mode. |
| External Server | Disabled | Centralized logging. Listens on UDP port 514. |
Basic Syslog Configuration
Configuring Destinations and Levels
! Configure Console logging (Levels 0 to specified level)
Router(config)# logging console 6
! Or use keyword: logging console informational
! Configure VTY/Telnet/SSH logging (Levels 0 to specified level)
Router(config)# logging monitor 6
! Or use keyword: logging monitor informational
! Configure Buffer logging (Optional size in bytes, then level)
Router(config)# logging buffered 16384 6
! Or use keyword: logging buffered informational
! Configure External Syslog Server IP
Router(config)# logging host 192.168.1.100
! Or simply: logging 192.168.1.100
! Set the severity level for the External Server (Levels 0 to specified level)
Router(config)# logging trap 7
! Or use keyword: logging trap debugging
Enabling VTY Logging for Active Sessions
Even if logging monitor is configured globally, you must enable it for your specific remote session.
Router# terminal monitor
Things to note: terminal monitor is not persistent. It must be executed every single time you connect via Telnet or SSH.
Improving CLI Readability
By default, incoming Syslog messages can interrupt and break up commands you are currently typing.
! Apply to console or VTY lines to force log messages to a new line
Router(config)# line console 0
Router(config-line)# logging synchronous
Configuring Timestamps and Sequence Numbers
! Enable Timestamps (Datetime is preferred over Uptime)
Router(config)# service timestamps log datetime
! Alternative: service timestamps log uptime
! Enable Sequence Numbers
Router(config)# service sequence-numbers
Syslog vs. SNMP Comparison
Both protocols are used for monitoring and troubleshooting, but they function differently and are complementary.
| Feature | Syslog | SNMP (Simple Network Management Protocol) |
|---|---|---|
| Primary Function | Message logging and event tracking. | Retrieving and organizing device variables (MIB). |
| Communication Flow | Push: Device sends messages to the server. Server cannot request data. | Pull/Push: Server can query device (Get) or device can send alerts (Trap). |
| Device Modification | Read-only (Logs events). | Can modify device variables using Set commands. |
| Transport / Port | UDP 514 | UDP 161 (Get/Set), UDP 162 (Traps) |
Command Summary
! --- Destination & Level Configuration ---
Router(config)# logging console [level]
Router(config)# logging monitor [level]
Router(config)# logging buffered [size] [level]
Router(config)# logging host [ip_address]
Router(config)# logging trap [level]
! --- Session & Readability Configuration ---
Router# terminal monitor
Router(config-line)# logging synchronous
! --- Formatting Configuration ---
Router(config)# service timestamps log datetime
Router(config)# service sequence-numbers
! --- Verification Commands ---
Router# show logging