Splunk Search

Problems exporting a BGP Status to a field

flweyand
Engager

Hi all,

i have a problem exporting a BGP event to a field.

Events:

%BGP-5-ADJCHANGE: neighbor $IPv6-IP$ Up
%BGP-5-ADJCHANGE: neighbor $IPv4-IP$ Up 
%BGP_SESSION-5-ADJCHANGE: neighbor $IPv6-IP$ IPv6 Unicast topology base removed from session  BGP Notification sent
%BGP-5-ADJCHANGE: neighbor $IPv6-IP$ Down BGP Notification sent
%BGP-5-NBR_RESET: Neighbor $IPv6-IP$ reset (BGP Notification sent)
%BGP-5-ADJCHANGE: neighbor $IPv4-IP$ Down Interface flap
%BGP-5-ADJCHANGE: neighbor $IPv4-IP$ Down Peer closed the session
%BGP_SESSION-5-ADJCHANGE: neighbor $IPv4-IP$ IPv4 Unicast topology base removed from session  Interface flap
%BGP-3-NOTIFICATION: sent to neighbor $IPv6-IP$ 4/0 (hold time expired) 0 bytes 

I need the export "Up / Down / reset" if its down i need a condition field "BGP Notification sent", "Interface flap", "Peer closed the session", "hold time expired"

I tried several Regex but i dont get it working.

Thank you and best regards
Florian

Tags (4)
0 Karma
1 Solution

MuS
Legend

Hi flweyand,

try something like this:

your base search to get the events | rex field=_raw "\$IPv[64]-IP\$\s(?<myStatus>\w+)\s" | rex field=_raw "\$IPv[64]-IP\$\sDown\s(?<myNotification>.*)" | table myStatus, myNotification

cheers, MuS

View solution in original post

MuS
Legend

Hi flweyand,

try something like this:

your base search to get the events | rex field=_raw "\$IPv[64]-IP\$\s(?<myStatus>\w+)\s" | rex field=_raw "\$IPv[64]-IP\$\sDown\s(?<myNotification>.*)" | table myStatus, myNotification

cheers, MuS

MuS
Legend

sure, if you build a transaction you will get a default field called duration 😉
please mark this as answered if it works for you - thanks

0 Karma

flweyand
Engager

Hi MuS,

thank you for your help. My search string is now:

source="ens_emea_syslog" sourcetype="cisco_syslog" BGP | rex field=_raw "([a-f0-9]+:\d+:\d+:\d+:\d+::\d+|\d+\.\d+\.\d+\.\d+)\s(?<BGP_Status>\w+)\s" | rex field=_raw "([a-f0-9]+:\d+:\d+:\d+:\d+::\d+|\d+\.\d+\.\d+\.\d+)\sDown\s(?<BGP_Down_Event>.*)" | rex field=_raw "([a-f0-9]+:\d+:\d+:\d+:\d+::\d+|\d+\.\d+\.\d+\.\d+)\s(active|passive)\s(?<BGP_AcPas_Event>.*)" | rex field=_raw "([a-f0-9]+:\d+:\d+:\d+:\d+::\d+|\d+\.\d+\.\d+\.\d+)\sreset\s(?<BGP_Reset_Event>.*)" | rex "(?i) .*? neighbor (?P<BGP_Neighbor>([a-f0-9]+:\d+:\d+:\d+:\d+::\d+|\d+\.\d+\.\d+\.\d+))(?= )" | eval time=date_hour.":".date_minute.":".date_second | eval date=date_mday.".".date_month.".".date_year | table date, time, host, BGP_Neighbor, BGP_Status, BGP_Down_Event, BGP_Reset_Event | rename host as "Alerting Host" 

and its working. Is it possible to transaction the "BGP_Neighbor" to measure the time between "Down" and "Up" ?

Best regards
Florian

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...