Splunk Search

unable to filter specific source with REX

cleelakrishna
Loves-to-Learn

i have data coming from different sources (catalina,sailpoint,accesslogs,etc) now i want to filter it into different source types , can you please help to filter the data using "rex" .
the below query retrieves all the sources even after extracting specific source.

index=sailpoint | rex field=source "\/srv\/tomcat7\/iiq\/logs\/(?.*)"

help will be appreciated

Tags (1)
0 Karma

niketn
Legend

Can you upload your search SPL query with 101010 button so that it does not get escaped? If you can add full path of various sources (mask server names if you have to), that would also be helpful. Based on the details provided there could be multiple ways of finding various sources.
1) Rex (If you can give examples of path we can help you with this)
2) Interactive Field Extraction (IFX) : You can try out Field Extraction from the Search and extract required source names and Splunk will write its own regular expression. This will also persist as Extracted Fields knowledge object.
3) Split command to split path by slash. This will be useful if you know that required source name is at certain specific folder depth then you can combine split with mvindex to get your source names.
4) use match condition to find source names. Following is run-anywhere example for the same based on information provided:

| makeresults
| eval source="\/srv\/tomcat7\/iiq\/logs\/catalina"
| eval sourceName=case(match(source,"catalina"),"catalina",match(source,"sailpoint"),"sailpoint",match(source,"accesslogs"),"accesslogs",true(),"Unmatched")
| table source sourceName
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...