Splunk Search

How initiate second search after getting field values from my first search?

BenTreeser
Explorer

I have two different searches. How do I concatenate them?

Search 1:

string1 | rex field=_raw "{(?\d+)"

Search 2:

string2 | rex field=_raw "needed * (?\d+)" | search runtime>5000

string1 != string2. What I want is to filter the results of search 2 by the item IDs found by search 1. How do I do it?

Tags (2)
0 Karma
1 Solution

markthompson
Builder

Hi Ben,
This is known as Sub-Searching, please see the link below which is the documentation for Sub searches.

http://docs.splunk.com/Documentation/Splunk/6.2.1/Search/Aboutsubsearches

Hope it helps

View solution in original post

markthompson
Builder

Hi Ben,
This is known as Sub-Searching, please see the link below which is the documentation for Sub searches.

http://docs.splunk.com/Documentation/Splunk/6.2.1/Search/Aboutsubsearches

Hope it helps

BenTreeser
Explorer

Helped me partly. Thanks

what I needed is furthermore was way of how to filter by all found field values. For this it is essential to differ between "rename my_field" as search and "rename my_field as query".

So the resulting query in my case would be:

string2* [|search string1 | rex field=_raw "{(?<my_field>-*\d+)"| rename my_field as query | fields query]* | rex field=_raw "needed * (?<runtime>\d+)" | search runtime>5000

markthompson
Builder

Hi Ben,
Glad it helped.

Please vote up!

0 Karma
Get Updates on the Splunk Community!

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

New Release | Splunk Cloud Platform 10.1.2507

Hello Splunk Community!We are thrilled to announce the General Availability of Splunk Cloud Platform 10.1.2507 ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...