Splunk IT Service Intelligence

Combining Splunk ITSI regular expression SPL?

AnushaJone
New Member

I need help to combine line 1 and 2 make it as one regular expression line in SPL query 

1.      | rex "(?<object>gov\.usda\.fsa\.[^\s]+)"
2.      | eval object=split(coalesce(object, "NA"),"."),object=mvindex(object,-1)

 

Please help!

Labels (1)
0 Karma

yeahnah
Motivator

Hi @AnushaJone 

You've not provided any example the raw event and the expected outcome of the rex.  So, assuming you are looking for the top-level domain each time, then here is a run anywhere example of what to do...

 

| makeresults
| eval _raw="gov.usda.fsa.blah"
| rex "(?<object>gov\.usda\.fsa\.[^\s]+)"
| eval object=split(coalesce(object, "NA"),"."), object=mvindex(object,-1)
| rex "gov\.usda\.fsa\.(?<object2>[^\s]+)"

 

So the last rex line gives the same result and the rex and eval above.  However, maybe you're looking for something more generic ¯\_(ツ)_/¯

Hope it helps


0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...