Splunk Search

help regex

DiviR
Engager

I have this kind of logs

00:00:47: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to down
00:00:48: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up
00:00:48: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/5, changed state to down

How can I extract severity and interface?

TIA

Tags (2)
0 Karma
1 Solution

mayurr98
Super Champion

hey try this

index=your_index | rex field=_raw "%\w+-(?P<Severity>[^\-]+)-.*Interface\s(?P<Interface>[^\,]+)"

Also check this to see this in action
https://regex101.com/r/IYRjiZ/1

Let me know if this helps!

View solution in original post

mayurr98
Super Champion

hey try this

index=your_index | rex field=_raw "%\w+-(?P<Severity>[^\-]+)-.*Interface\s(?P<Interface>[^\,]+)"

Also check this to see this in action
https://regex101.com/r/IYRjiZ/1

Let me know if this helps!

DiviR
Engager

thanks it works but is there any way to extract description as well after interface?

0 Karma

mayurr98
Super Champion

try this then

    index=your_index | rex field=_raw "%\w+-(?P<Severity>[^\-]+)-.*Interface\s(?P<Interface>[^\,]+)\,(?P<Description>.*)"
Get Updates on the Splunk Community!

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 ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...