Skip to content

Commit

Permalink
Merge pull request #488 from splunk/feature/cisco-aireos
Browse files Browse the repository at this point in the history
Support Cisco AireOS format
  • Loading branch information
Ryan Faircloth authored and GitHub committed May 27, 2020
2 parents 2875979 + 2bdfa37 commit b8200db
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
15 changes: 10 additions & 5 deletions docs/sources/Cisco/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,16 @@ index=<asconfigured> sourcetype=cisco:asa

Verify timestamp, and host values match as expected

## Product - IOS and NX-OS based equipment
## Product - Cisco Networking

Cisco Network Products of multiple types share common logging characteristics the following types are known to be compatible:

* Cisco AireOS (AP & WLC)
* Cisco IOS
* Cisco IOS-XR
* Cisco IOS-XE
* Cisco NX-OS


| Ref | Link |
|----------------|---------------------------------------------------------------------------------------------------------|
Expand Down Expand Up @@ -221,10 +230,6 @@ Verify timestamp, and host values match as expected
| SC4S_LISTEN_CISCO_IOS_TCP_PORT | empty string | Enable a UDP port for this specific vendor product using the number defined |
| SC4S_ARCHIVE_CISCO_IOS | no | Enable archive to disk for this specific source |
| SC4S_DEST_CISCO_IOS_HEC | no | When Splunk HEC is disabled globally set to yes to enable this specific source |
| SC4S_LISTEN_CISCO_NX_OS_TCP_PORT | empty string | Enable a TCP port for this specific vendor product using the number defined |
| SC4S_LISTEN_CISCO_NX_OS_UDP_PORT | empty string | Enable a UDP port for this specific vendor product using the number defined |
| SC4S_ARCHIVE_CISCO_NXOS | no | Enable archive to disk for this specific source |
| SC4S_DEST_CISCO_NXOS_HEC | no | When Splunk HEC is disabled globally set to yes to enable this specific source |

### Verification

Expand Down
28 changes: 26 additions & 2 deletions package/etc/conf.d/filters/cisco/cisco_syslog.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ parser cisco-parser-ex{
condition(not host("."))
);
};
} else {
# All other cisco syslog
} elif {
#Cisco IOS Other
filter {
message('^<\d*> ?(?:(\d+)\: )?(?:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]): )?(?:(\d+): )?(?:(\d\d:\d\d:\d\d|\d{1,6} \d{1,2}))?(?:(\*)?((?:\w\w\w {1,2}\d{1,2} (?:\d{2,4} )?\d\d:\d\d:\d\d)(?:\.\d{3,6})?( [AP]M)?)( [A-Za-z]{3,3} )?)? ?((?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))? ?: ((\%[^\: ]+)\:? ?.*)'
flags(store-matches));
Expand Down Expand Up @@ -82,6 +82,30 @@ parser cisco-parser-ex{
'%b %d %Y %H:%M:%S')
template("$8"));
};
} else {
#Cisco AireOS format
filter {
message('^<\d*>(?:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]): )(?:[^:]*: )((?:\w\w\w {1,2}\d{1,2} (?:\d{2,4} )?\d\d:\d\d:\d\d)(?:\.\d{3,6})): ((\%[^\: ]+)\:? ?.*)' flags(store-matches));
};

parser { date-parser-nofilter(format(
'%b %d %H:%M:%S.%f'
)
template("$4"));
};

rewrite {
set(
"${2}",
value("HOST")

);
set(
"${5}",
value("MESSAGE")
);
};

};
};
};
5 changes: 3 additions & 2 deletions tests/test_cisco_ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# foo: 1 2: %SYSMGR-STANDBY-3-SHUTDOWN_START: The System Manager has started the shutdown procedure.shutdown procedure.
# 101 21: %SYSMGR-STANDBY-3-SHUTDOWN_START: The System Manager has started the shutdown procedure.shutdown procedure.
# *Mar 1 18:48:50.483 UTC: %SYS-5-CONFIG_I: Configured from console by vty2 (10.34.195.36)

# <132>xxxxx: *spamApTask1: May 26 18:52:01.958: %CAPWAP-4-DISC_INTF_ERR2: [PA]capwap_ac_sm.c:2053 Ignoring Primary discovery request received on a wrong VLAN (202) on interface (8) from AP 00:b7:00:00:00:00
testdata = [
"{{ mark }}{{ seq }}: {{ host }}: 6340004: *{{ bsd }}: %SEC-6-IPACCESSLOGP: list INET-BLOCK permitted tcp 192.168.20.252(55244) -> 10.54.3.178(44818), 1 packet",
"{{ mark }}{{ seq }}: {{ host }}: *{{ bsd }}.{{ microsec }}: %SYS-6-LOGGINGHOST_STARTSTOP: Logging to host 192.168.1.239 stopped - CLI initiated {{ bsd }}.{{ millisec }}",
Expand All @@ -38,7 +38,8 @@
"{{ mark }}{{ seq }}: {{ host }}: {{ bsd }}.{{ millisec }}: %SYS-6-LOGGINGHOST_STARTSTOP: Logging to host 192.168.1.239 stopped - CLI initiated",
"{{ mark }}{{ host }}: {{ bsd }}.{{ millisec }}: %SYSMGR-STANDBY-3-SHUTDOWN_START: The System Manager has started the shutdown procedure. {{ bsd }}.{{ millisec }}",
"{{ mark }}*{{ bsd }}.{{ millisec }} {{ tzname }}: %SYS-5-CONFIG_I: Configured from console by vty2 (10.34.195.36) {{ host }}",
"{{ mark }}84027: {{ bsd }}.{{ millisec }} dst: %SYS-5-CONFIG_I: Configured from console by username on vty0 ({{ host }})"
"{{ mark }}84027: {{ bsd }}.{{ millisec }} dst: %SYS-5-CONFIG_I: Configured from console by username on vty0 ({{ host }})",
"{{ mark }}{{ host }}: {{ bsd }}.{{ millisec }}: %CAPWAP-4-DISC_INTF_ERR2: [PA]capwap_ac_sm.c:2053 Ignoring Primary discovery request received on a wrong VLAN (202) on interface (8) from AP 00:b7:00:00:00:00"
]

testdata_uptime = [
Expand Down

0 comments on commit b8200db

Please sign in to comment.