Splunk Search

Can you help me with the following Splunk search query?

jafarmat
New Member

Hi,

So i'm having this rule...

  index=logs sourcetype=console_test_1 "[Status] Discovered" 
    | rex "<regex rule>" | table orderId 

...that outputs me a column with IDs. What i want to do is something like getting these IDs and using them in another search, which results i want to append to the one above. The second result is from another source type.

So, something like this:

  index=logs sourcetype=console_test_1 "[Status] Discovered" 
    | rex "<regex rule>" | table orderId ->  sourcetype=console_test_2 <orderId> | rex "<regex rule2>" | table result2 -> join column

I've search the net but haven't figured it out yet.

Thank you

Tags (1)
0 Karma

mstjohn_splunk
Splunk Employee
Splunk Employee

hi @jafarmat,

Did the answer below solve your problem? If so, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I believe you want a subsearch. Subsearch results are passed to and become part of the main search.

See if this gets you going in the right direction.

sourcetype=console_test_2 [index=logs sourcetype=console_test_1 "[Status] Discovered" 
 | rex "<regex rule>" | fields orderId | format] | rex "<regex rule2>" | table result2
---
If this reply helps you, Karma would be appreciated.
0 Karma

jafarmat
New Member

The thing is that i need the results(only one column) from let s say regex rule 2 so i can use them in regex rule1.I know about subsearches but i ve never seen one done in this manner

0 Karma

richgalloway
SplunkTrust
SplunkTrust

You may need to be more specific about using the results of regex rule 2 in regex rule 1 as that is pretty much what this search does. It uses regex rule 1 to return a set of results that are then searched by regex rule 2.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...