Splunk Search

How to join fields from other index with comparing fields

ykwon7
Observer

Hello,

Cloud you give me some tips.

Search Query S1
index=S1
| bla bla bla
| stats value(dstIP) value(dstPort) value(srcIP) value(srcUser) by URL

In S1's results, I want to add "sum(Byte)", Byte is in S2.
Also S2's log has dstIP, dstPort and Byte.
From comparing S1_dstIP with S2_dstIP, I want to add "sum(Byte)" on the search result.

0 Karma

ykwon7
Observer

S1's log ={dstIP, dstPort, srcIP,srcPort, srcUser, URL}
S2's log ={dstIP, dstPort, srcIP,srcPort, srcUser, Bytes}

Result = dstIP, dstPort, srcIP,srcPort, srcUser, sum(Bytes) by URL

So then, I think it needs to be joined by comparing dstIP, dstPort

0 Karma

to4kawa
Ultra Champion
index=S1 OR index=S2
| eval key=dstIP."_".dstPort."_".srcIP."_".srcPort."_".srcUser
| stats values(URL) as URL sum(Byte) as Bytes by key
| rex field=key "(?<dstIP>.*?)_(?<dstPort>.*?)_(?<srcIP>.*?)_(?<srcPort>.*?)_(?<srcUser>.*)"
| table URL Bytes dstIP dstPort srcIP srcUser
| where isnotnull(URL)

see reference: https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Stats

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