elastic / integrations

Elastic Integrations
https://www.elastic.co/integrations
Other
194 stars 418 forks source link

cisco_ios: Further parsing required #3902

Open getkub opened 2 years ago

getkub commented 2 years ago

Hi Cisco IOS module needs further parsing and samples https://github.com/elastic/integrations/blob/main/packages/cisco_ios/data_stream/log/elasticsearch/ingest_pipeline/default.yml

In above, the LOGIN_FAILED is not captured Please find the code and sample event for it

  - dissect:
      field: message
      pattern: "%{cisco.ios.action} %{_temp_.event.action} [user: %{source.user.name}] [Source: %{source.address}] [localport: %{destination.port}] [Reason: %{event.reason}] at %{}"
      if: "ctx.event?.code == 'LOGIN_FAILED'"

Sample event

Jul 29 13:49:12 194.159.101.44 894: 000893: Jul 29 2022 12:49:11.159 UTC: %SEC_LOGIN-4-LOGIN_FAILED: Login failed [user: ABCD] [Source: 112.123.2.38] [localport: 22] [Reason: Login Authentication Failed] at 12:49:11 UTC Fri Jul 29 2022
elasticmachine commented 2 years ago

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

getkub commented 2 years ago

Below are list of common event.code of Cisco IOS and most of them needs to be developed

EXCESSIVE_PARITY_ERROR
STATECHANGE
RFI
ADJCHANGE
NBR_RESET
NOTIFICATION
AUTHFAIL
AUTHENFAIL
UPDOWN
FRR_STATE
MSGDUMP
MAXPFXEXCEED
ECC_MSG
BADAUTH
STATE
IKMP_MODE_FAILURE
LTL_PARITY_CHECK
PLATFORM
FMANACLLOGMISSMSG
IPACCESSLOGNP
NF_PARITY_ERROR
BER_SF_ALARM
MAXPFX
SIGNAL
THRESHOLD_VIOLATION
CPU_WARNING_OVERTEMP
FAN_LOW_RPM
FAN_TRAY_MISSING
MULTI_FAN_LOW_RPM
INFO_USER_LOGOUT
INFO_GENERAL
INFO_SUCCESS
NOPACKET
BFD_SESS_UP
IKMP_BAD_MESSAGE
WARNING_LOGIN
CONFIG_I
IN_OUTLET_OVERTEMP
DAMPENING
TIMEOUT
BFD_SESS_DOWN
CLOSED
BFD_SESS_DESTROYED
IPACCESSLOGS
SESSION_STATE_DOWN
SESSION_STATE_UP
BFD_SESS_CREATED
ADJCHANGE_DETAIL
IPACCESSLOGDP
efd6 commented 2 years ago

Docs available here.

@getkub Are you able to provide examples for testing?

getkub commented 2 years ago

attached samples samplelog.cisco.ios.log

getkub commented 2 years ago

Also attached some enrichments, which may be useful to externalise the logic cisco_ios_aci_fault_codes.csv cisco_ios_actions.csv cisco_ios_icmp_code.csv

In my view, the ingest pipeline should have a lookup/enrichment facility, that way the enrichments can be done outside the grok/parsing.

efd6 commented 1 year ago

Documentation and test input:

Documentation but no test:

No documentation at in https://www.cisco.com/c/en/us/td/docs/ios/15_0sy/system/messages/15sysmg.pdf.

botelastic[bot] commented 11 months ago

Hi! We just realized that we haven't looked into this issue in a while. We're sorry! We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

essinghigh commented 4 months ago

In terms of ADJCHANGE: Apr 27 20:54:43.799 BST: %BGP-5-ADJCHANGE: neighbor 10.7.247.102 Down BFD adjacency down Apr 27 20:54:51.594 BST: %BGP-5-ADJCHANGE: neighbor 10.7.247.102 Up

Would be very useful to add these as an enhancement to the Cisco IOS integration. I'm currently using the following Grok to extract and it has worked well for us:

condition ctx.event.code == "ADJCHANGE"
(neighbor|peer) %{IP:neighbor.ip} (%{DATA:bgp.state.to} BFD|\(AS \d+\) old state (Established|OpenConfirm) event \w+ new state %{GREEDYDATA:bgp.state.to}|(?<bgp.state.to>Up)|(?<bgp.state.to>Down) .*|active (?<bgp.state.to>Down) .*)

It's certainly not a nice way of doing it, but it was my first time playing around with Grok, and if it ain't broke... ;)

Another one I don't see here is CLIENT_ADDED_TO_RUN_STATE for WLCs, which would also be a nice-to-have.

Apr 30 2024 13:01:55.365 UTC: %CLIENT_ORCH_LOG-6-CLIENT_ADDED_TO_RUN_STATE: Chassis 1 R0/3: wncd: Username entry (exampleuser) joined with ssid (examplessid) for device with MAC: 0000.0000.0000

condition ctx.event.code == "CLIENT_ADDED_TO_RUN_STATE"
Chassis \d R\d/\d: wncd: Username entry \(%{GREEDYDATA:wlan_username}\) joined with ssid \(%{DATA:wlan_ssid}\) for device with MAC: %{GREEDYDATA:wlan_user_mac}