Splunk Search

need help with joining two queries

pench2k19
Explorer

Hi ninjas,

i have two queries with ] the output as follows

query1 output fields:

SOR filename expected_time
1ci extract 12:30:00 10-5-2019

query2 output fields:
SOR ** filename** real_time
1art congig 01:30:00 10-5-2019

The second query values are subset of first query.

Now i want to print the values of SOR , filename and expected_time when there is no real_time value in the second query.

can you please help here.

@jkat54 @vnravikumar @somesoni2 @woodcock

Tags (1)
0 Karma

woodcock
Esteemed Legend

I cannot help unless you show us the 2 searches (the SPL).

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi pench2k19,

best option is to forget about join completely for reasons.

Just use a plain stats instead:

 query1 OR query2 | stats values(*) AS * by SOR

this works best, and you will not hit any hidden limits 😉

Learn more over here https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-jo...

cheers, MuS

0 Karma

pench2k19
Explorer

Hi @MuS

Thanks for the response.

It's not working unfortunately.

Let me tell the clear requirement here... I need the SOR, Filename, expected_time values when there is no arrival time. Can you please suggest me the alternative way

Unfortunately I m not able copy my query here.

0 Karma

pench2k19
Explorer

To give you more context, in the first query I have loopkup file as data source and in the second query I mean using real time logs.

0 Karma

pench2k19
Explorer

Hi @MuS

Thanks for the reply.

Unfortunately your solution is not working in my case.

0 Karma

MuS
SplunkTrust
SplunkTrust

I'm pretty sure it would if you could provide more context, and some sample events 😉

0 Karma

koshyk
Super Champion

I'm not clear on your query, if you need a lookup or join or transaction between the queries

Just a guess, Is this what you are expecting? The below should print fields irrespective of and if SOR is both the same, it will print the join

<query1> 
| join type=left SOR [|<query2>]
0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

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