Subject: | Cisco IOS date format |
once again ;(
We have some Cisco IOS routers that log the second timestamp with the year after the day, not before the name of the month:
<189>May 8 19:12:19 router.company.tld 11815005: May 8 2014 19:12:18.454 CET: %CRYPTO-5-IPSEC_SETUP_FAILURE: IPSEC SETUP FAILED for local:1.2.3.4 local_id:1.2.3.4 remote:4.5.6.7 remote_id:4.5.6.7 IKE profile:foo fvrf:None fail_reason:IPSec Proposal failure fail_class_cnt:14
I've added a second year part to the date_long regex to fix the parsing:
date_long => qr/^
(?:[0-9]{4}\s+)? # Year: Because, Cisco
([.*])? # Cisco adds a * for no ntp, and a . for configured but out of sync
[a-zA-Z]{3}\s+[0-9]+ # Date: Jan 1
(?:\s+[0-9]{4})? # Year: Because, Cisco
\s+ # Date Separator: spaces
[0-9]{1,2}(?:\:[0-9]{2}){1,2} # Time: HH:MM or HH:MM:SS
(?:\.[0-9]{3})? # Time: .DDD ms resolution
(?:\s+[A-Z]{3,4})? # Timezone, ZZZ or ZZZZ
(?:\:?) # Cisco adds a : after the second timestamp
/x,