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!

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