Splunk Search

Multiple search values pass to another search

Prasenjit1508
New Member

I have a query which returns 100 ids(ids are dynamic). I have to search for these 100 ids in another log and see if they exist.
Ex: Search1 returns id1,id2,id3,id4
search 2 uses the above ids ( id1,id2,id3,id4) to search in this log

How to do I create 1 single query to do this.

The objective is request goes from server A to Server B. We need to check whether server B got the request from server A by using its requestid

Tags (1)
0 Karma

renjith_nair
Legend

@Prasenjit1508,

You could do that with subsearch since the number of ids are within sub search limit(50k)

"search 2 with its search terms" [ search1 to get all required ids|field id] 

Make sure you have the same field names in both search.

Here is a run anywhere example

index=_internal   earliest=-5m
 [|  makeresults | eval sourcetype="splunkd splunkd_ui_access" | makemv sourcetype| mvexpand sourcetype| fields - _time]
 | stats count by sourcetype

In the above case, the final search is

   index=_internal (sourcetype="splunkd" OR sourcetype="splunkd_ui_access") _time>=1552714093.000
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

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 at Splunk .conf24 ...

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

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...