Splunk Search

Searching intersection of two subsets

nik_splunk
Path Finder

Hello Splunkers,

Thanks to visit my question.

I have two subsets of data related to each other.

  1. The set A consists of 50 items. Of these, only top 5 items interests me (subset AA'),assessed a condition.
  2. The set B contains 25 items. Of these, only top 5 items interests me (subset BB'),assessed a condition.

My goal is:

  1. search for the top 5 elements of AA ', once assessed a condition.
  2. search for the top 5 elements of B, once assessed a required condition.
  3. Count how many intersections have the elements of AA ' with each of the top 5 elements of BB'.
  4. (subsearch AA') AND (subsearch BB') gives different results if (subsearch BB') AND (subsearch AA')

Can someone kindly suggest me how to build that search using only the subsearches?

Thanks in advance.

Nik (currently working on splunk 4.0.9)

0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

There is a way to do this in Splunk using the set commands ( http://www.splunk.com/base/Documentation/latest/SearchReference/Set ) , but it is likely that there is a far more efficient way to do it without the set command or a bunch of subsearches. (By filtering the data all at once, and then doing ... | top 5 by subsetname | stats count by commonfield, but whether this is possible depends on the specific conditions and the data).

In general, it may be a good idea to give examples or describe what your incoming data is and what you want out, rather that specifying the specific algorithm, because a lot of set-based/table-based algorithms may be replaced with better algorithms that take better advantage of how Splunk processes data.

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

There is a way to do this in Splunk using the set commands ( http://www.splunk.com/base/Documentation/latest/SearchReference/Set ) , but it is likely that there is a far more efficient way to do it without the set command or a bunch of subsearches. (By filtering the data all at once, and then doing ... | top 5 by subsetname | stats count by commonfield, but whether this is possible depends on the specific conditions and the data).

In general, it may be a good idea to give examples or describe what your incoming data is and what you want out, rather that specifying the specific algorithm, because a lot of set-based/table-based algorithms may be replaced with better algorithms that take better advantage of how Splunk processes data.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...