Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Template for Cisco IOS Log Messages #554

Merged
merged 12 commits into from
Dec 11, 2019
99 changes: 99 additions & 0 deletions templates/cisco_ios_show_logging.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
Value NUMBER (\d+)
Value MONTH (\S+)
Value DAY (\d{1,2})
Value TIME ((\d+:\d+:\d+\.\d+)|(\d+:\d+:\d+)|(\d{1,2}:\d{1,2}))
Value TIMEZONE (\S{3})
Value FACILITY (\w+)
Value SEVERITY (\d)
Value MNEMONIC (\S+)
Value List MESSAGE (.+)

Start
^Log\s+Buffer
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
# 022701: Jun 19 03:02:31: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet2/0/3, changed state to down
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
# 000024: Dec 2 12:09:21.207: CEF-HWIDB: EDSP0 LES switching vector set to Null
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
^${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> DateLogs
# Jan 30 14:11:11.354: %ILPOWER-7-DETECT: Interface Gi4/3: Power Device detected: IEEE PD
^${MONTH}\s+${DAY}\s+${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> DateLogs
^${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> DateLogs
^${MONTH}\s+${DAY}\s+${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> DateLogs
# 7:04: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet2/0/3, changed state to up
^${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> TimeLogs
^${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> TimeLogs


NumberLogs
^(\d{6}):\s+(\D\D\D)\s+(\d{1,2})\s+((\d+:\d+:\d+\.\d+)|(\d+:\d+:\d+)) -> Continue.Record
^(\D\D\D)\s+(\d{1,2})\s+((\d+:\d+:\d+\.\d+)|(\d+:\d+:\d+)) -> Continue.Record
^\d{1,2}:\d{1,2}: -> Continue.Record
# NUMBER LOGS
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$
afoster213 marked this conversation as resolved.
Show resolved Hide resolved
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$
# NUMBER LOGS NO SEVERITY
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$
# DATE LOGS
^${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE} -> DateLogs
^${MONTH}\s+${DAY}\s+${TIME}:\s%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE} -> DateLogs
# DATE LOGS NO SEVERITY
^${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE} -> DateLogs
^${MONTH}\s+${DAY}\s+${TIME}:\s${FACILITY}-${MNEMONIC}:\s+${MESSAGE} -> DateLogs
# TIME LOGS
^${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> TimeLogs
# TIME LOGS NO SEVERITY
^${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> TimeLogs
^${MESSAGE}$$
^\s*$$
^. -> Error

afoster213 marked this conversation as resolved.
Show resolved Hide resolved
DateLogs
^(\D\D\D)\s+(\d{1,2})\s+((\d+:\d+:\d+\.\d+)|(\d+:\d+:\d+)) -> Continue.Record
^(\d{6}):\s+(\D\D\D)\s+(\d{1,2})\s+((\d+:\d+:\d+\.\d+)|(\d+:\d+:\d+)) -> Continue.Record
^\d{1,2}:\d{1,2}: -> Continue.Record
# DATE LOGS
^${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}
^${MONTH}\s+${DAY}\s+${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}
# DATE LOGS NO SEVERITY
^${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}
^${MONTH}\s+${DAY}\s+${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}
# NUMBER LOGS
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
# NUMBER LOGS NO SEVERITY
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
# TIME LOGS
^${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> TimeLogs
# TIME LOGS NO SEVERITY
^${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> TimeLogs
^${MESSAGE}$$
^\s*$$
^. -> Error

TimeLogs
^\d{1,2}:\d{1,2}: -> Continue.Record
^(\D\D\D)\s+(\d{1,2})\s+((\d+:\d+:\d+\.\d+)|(\d+:\d+:\d+)) -> Continue.Record
^\d+:\s+\S+ -> Continue.Record
# TIME LOGS
^${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$
# TIME LOGS NO SEVERITY
^${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$
# DATE LOGS
^${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE} -> DateLogs
^${MONTH}\s+${DAY}\s+${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE} -> DateLogs
# DATE LOGS NO SEVERITY
^${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE} -> DateLogs
^${MONTH}\s+${DAY}\s+${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE} -> DateLogs
# NUMBER LOGS
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}:\s+%${FACILITY}-${SEVERITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
# NUMBER LOGS NO SEVERITY
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}\s+${TIMEZONE}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
^${NUMBER}:\s+${MONTH}\s+${DAY}\s+${TIME}:\s+${FACILITY}-${MNEMONIC}:\s+${MESSAGE}$$ -> NumberLogs
^${MESSAGE}$$
^\s*$$
^. -> Error
3 changes: 2 additions & 1 deletion templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ cisco_ios_show_ip_route.textfsm, .*, cisco_ios, sh[[ow]] ip r[[oute]]
cisco_ios_show_aliases.textfsm, .*, cisco_ios, sh[[ow]] alia[[ses]]
cisco_ios_show_archive.textfsm, .*, cisco_ios, sh[[ow]] arc[[hive]]
cisco_ios_show_license.textfsm, .*, cisco_ios, sh[[ow]] lic[[ense]]
cisco_ios_show_logging.textfsm, .*, cisco_ios, sh[[ow]] log[[ging]]
cisco_ios_show_standby.textfsm, .*, cisco_ios, sh[[ow]] sta[[ndby]]
cisco_ios_show_version.textfsm, .*, cisco_ios, sh[[ow]] ver[[sion]]
cisco_ios_show_ip_arp.textfsm, .*, cisco_ios, sh[[ow]] i[[p]] a[[rp]]
Expand Down Expand Up @@ -251,7 +252,7 @@ cisco_wlc_ssh_show_cdp_neighbors_detail.textfsm, .*, cisco_wlc_ssh, sh[[ow]] c[[
cisco_wlc_ssh_show_rf-profile_summary.textfsm, .*, cisco_wlc_ssh, sh[[ow]] rf-[[profile]] s[[ummary]]
cisco_wlc_ssh_show_ap_config_general.textfsm, .*, cisco_wlc_ssh, sh[[ow]] ap con[[fig]] ge[[neral]]
cisco_wlc_ssh_show_interface_summary.textfsm, .*, cisco_wlc_ssh, sh[[ow]] int[[erface]] s[[ummary]]
cisco_wlc_ssh_show_client_detail.textfsm, .*, cisco_wlc_ssh, sh[[ow]] cl[[ient]] det[[ail]]
cisco_wlc_ssh_show_client_detail.textfsm, .*, cisco_wlc_ssh, sh[[ow]] cl[[ient]] det[[ail]]
cisco_wlc_ssh_show_exclusionlist.textfsm, .*, cisco_wlc_ssh, sh[[ow]] ex[[clusionlist]]
cisco_wlc_ssh_show_ap_summary.textfsm, .*, cisco_wlc_ssh, sh[[ow]] ap sum[[mary]]
cisco_wlc_ssh_show_inventory.textfsm, .*, cisco_wlc_ssh, sh[[ow]] inve[[ntory]]
Expand Down
30 changes: 30 additions & 0 deletions tests/cisco_ios/show_logging/cisco_ios_show_logging_1.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Syslog logging: enabled (0 messages dropped, 34 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)

No Active Message Discriminator.



No Inactive Message Discriminator.


Console logging: level debugging, 22827 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 68 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 22860 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, 22790 message lines logged
Logging Source-Interface: VRF Name:

Log Buffer (16384 bytes):
7:04: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet2/0/3, changed state to up
022701: Jun 19 03:02:31: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet2/0/3, changed state to down
022702: Jun 19 03:02:32: %LINK-3-UPDOWN: Interface GigabitEthernet2/0/3, changed state to down
022703: Jun 19 03:02:37: %LINK-3-UPDOWN: Interface GigabitEthernet2/0/3, changed state to up
42 changes: 42 additions & 0 deletions tests/cisco_ios/show_logging/cisco_ios_show_logging_1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
parsed_sample:
- number: ""
month: ""
day: ""
time: "7:04"
timezone: ""
facility: "LINEPROTO"
severity: "5"
mnemonic: "UPDOWN"
message:
- "Line protocol on Interface GigabitEthernet2/0/3, changed state to up"
- number: "022701"
month: "Jun"
day: "19"
time: "03:02:31"
timezone: ""
facility: "LINEPROTO"
severity: "5"
mnemonic: "UPDOWN"
message:
- "Line protocol on Interface GigabitEthernet2/0/3, changed state to down"
- number: "022702"
month: "Jun"
day: "19"
time: "03:02:32"
timezone: ""
facility: "LINK"
severity: "3"
mnemonic: "UPDOWN"
message:
- "Interface GigabitEthernet2/0/3, changed state to down"
- number: "022703"
month: "Jun"
day: "19"
time: "03:02:37"
timezone: ""
facility: "LINK"
severity: "3"
mnemonic: "UPDOWN"
message:
- "Interface GigabitEthernet2/0/3, changed state to up"
38 changes: 38 additions & 0 deletions tests/cisco_ios/show_logging/cisco_ios_show_logging_2.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Syslog logging: enabled (0 messages dropped, 4 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)

No Active Message Discriminator.



No Inactive Message Discriminator.


Console logging: level alerts, 0 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 91442 messages logged, xml disabled,
filtering disabled
Exception Logging: size (4096 bytes)
Count and timestamp logging messages: disabled
Persistent logging: disabled

No active filter modules.

ESM: 0 messages dropped

Trap logging: level informational, 142 message lines logged
Logging to 10.5.2.1 (udp port 514, audit disabled,
link up),
142 message lines logged,
0 message lines rate-limited,
0 message lines dropped-by-MD,
xml disabled, sequence number disabled
filtering disabled
Logging Source-Interface: VRF Name:

Log Buffer (16384 bytes):
IEEE PD
Jan 30 14:11:11.354: %ILPOWER-7-DETECT: Interface Gi4/3: Power Device detected: IEEE PD
Jan 30 14:11:55.762: %SYS-5-CONFIG_I: Configured from console by cisco on vty0 (172.16.5.22)
Jan 30 14:11:32.142: %ILPOWER-7-DETECT: Interface Ten1/1: Power Device detected: IEEE PD
32 changes: 32 additions & 0 deletions tests/cisco_ios/show_logging/cisco_ios_show_logging_2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
parsed_sample:
- number: ""
month: "Jan"
day: "30"
time: "14:11:11.354"
timezone: ""
facility: "ILPOWER"
severity: "7"
mnemonic: "DETECT"
message:
- "Interface Gi4/3: Power Device detected: IEEE PD"
- number: ""
month: "Jan"
day: "30"
time: "14:11:55.762"
timezone: ""
facility: "SYS"
severity: "5"
mnemonic: "CONFIG_I"
message:
- "Configured from console by cisco on vty0 (172.16.5.22)"
- number: ""
month: "Jan"
day: "30"
time: "14:11:32.142"
timezone: ""
facility: "ILPOWER"
severity: "7"
mnemonic: "DETECT"
message:
- "Interface Ten1/1: Power Device detected: IEEE PD"
48 changes: 48 additions & 0 deletions tests/cisco_ios/show_logging/cisco_ios_show_logging_3.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Syslog logging: enabled (0 messages dropped, 2 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)

No Active Message Discriminator.



No Inactive Message Discriminator.


Console logging: disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 25903 messages logged, xml disabled,
filtering disabled
Exception Logging: size (4096 bytes)
Count and timestamp logging messages: disabled
Persistent logging: disabled

No active filter modules.

Trap logging: level debugging, 25907 message lines logged
Logging to 10.12.55.11 (udp port 514, audit disabled,
link up),
25907 message lines logged,
0 message lines rate-limited,
0 message lines dropped-by-MD,
xml disabled, sequence number disabled
filtering disabled
Logging to 10.12.55.13 (udp port 514, audit disabled,
link up),
25907 message lines logged,
0 message lines rate-limited,
0 message lines dropped-by-MD,
xml disabled, sequence number disabled
filtering disabled
Logging Source-Interface: VRF Name:

Log Buffer (10000000 bytes):

Jan 2 12:00:05.047: %IOS_LICENSE_IMAGE_APPLICATION-6-LICENSE_LEVEL: Module name = c2900 Next reboot level = ipbasek9 and License = ipbasek9
000048: Dec 2 12:09:21.207: CEF-HWIDB: EDSP0 LES switching vector set to Null
000049: Dec 2 12:09:23.643: %LINEPROTO-5-UPDOWN: Line protocol on Interface Embedded-Service-Engine0/0, changed state to down
000050: Dec 2 12:09:25.715: %SYS-5-RESTART: System restarted --
Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.2(1)T1, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2011 by Cisco Systems, Inc.
Compiled Mon 19-Sep-11 17:41 by prod_rel_team
000051: Dec 2 12:09:25.719: %SNMP-5-COLDSTART: SNMP agent on host EDGE-2901-Router is undergoing a cold start
56 changes: 56 additions & 0 deletions tests/cisco_ios/show_logging/cisco_ios_show_logging_3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
parsed_sample:
- number: ""
month: "Jan"
day: "2"
time: "12:00:05.047"
timezone: ""
facility: "IOS_LICENSE_IMAGE_APPLICATION"
severity: "6"
mnemonic: "LICENSE_LEVEL"
message:
- "Module name = c2900 Next reboot level = ipbasek9 and License = ipbasek9"
- number: "000048"
month: "Dec"
day: "2"
time: "12:09:21.207"
timezone: ""
facility: "CEF"
severity: ""
mnemonic: "HWIDB"
message:
- "EDSP0 LES switching vector set to Null"
- number: "000049"
month: "Dec"
day: "2"
time: "12:09:23.643"
timezone: ""
facility: "LINEPROTO"
severity: "5"
mnemonic: "UPDOWN"
message:
- "Line protocol on Interface Embedded-Service-Engine0/0, changed state to down"
- number: "000050"
month: "Dec"
day: "2"
time: "12:09:25.715"
timezone: ""
facility: "SYS"
severity: "5"
mnemonic: "RESTART"
message:
- "System restarted --"
- "Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.2(1)T1, RELEASE SOFTWARE (fc1)"
- "Technical Support: http://www.cisco.com/techsupport"
- "Copyright (c) 1986-2011 by Cisco Systems, Inc."
- "Compiled Mon 19-Sep-11 17:41 by prod_rel_team"
- number: "000051"
month: "Dec"
day: "2"
time: "12:09:25.719"
timezone: ""
facility: "SNMP"
severity: "5"
mnemonic: "COLDSTART"
message:
- "SNMP agent on host EDGE-2901-Router is undergoing a cold start"
Loading