Splunk Search

Searching a 2nd index with a field extraction using rex

dhabbal
Explorer

I have a index=weblogs where I filter results and then REX extract an IP address to a new field called RemoteIP.

I want to then search our firewall logs on index=firewall for that newly extracted field RemoteIP.

I have been playing around with sub searches and joins but not getting far. 

 

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
index=firewall [ search index=weblogs | rex "extract remote ip" | dedup remoteIP | rename remoteIP as ipFieldInFirewall | fields ipFieldInFirewall ]

View solution in original post

dhabbal
Explorer

Believe it or not I figured it out shortly after you posted this solution. Thank you!


Can I ask how to now use join? I want to bring in fields from index=weblogs into the outter search. 

 

The common field would be src_ip. 

Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index=firewall 
| join ipFieldInFirewall [ search index=weblogs | rex "extract remote ip" | dedup remoteIP | rename remoteIP as ipFieldInFirewall | fields ipFieldInFirewall plus other fields ]

dhabbal
Explorer

Thanks for this, I tried this join syntax earlier but the search was very slow and wasn't able to be completed.

Firewall logs are huge but I thought the subsearch runs first that feeds the join cmd, in my mind it should run fairly quickly but it's taking very long. 

Any ideas how to make the search more performative?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index=firewall [ search index=weblogs | rex "extract remote ip" | dedup remoteIP | rename remoteIP as ipFieldInFirewall | fields ipFieldInFirewall ]
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...