Splunk Search

Combine and count results from two queries without join command

Sakshi_Parashar
Engager

So, if I have an index=abc with fields a,b

Also, I have index=xyz with fields b,c

Now I want to count the results where a="foo", c="bar" and b from both indices are common. I want to do this without join because of the maxout limitation.

A sample query with join is:

 

index="abc" a="foo" | join type=inner b [search(index="xyz" c="bar")] | timechart span="1h" count as foobar 

 

Can someone help with a query giving the same result without join?

Labels (4)
0 Karma
1 Solution

Sakshi_Parashar
Engager

Found a working solution for the above problem,

 

 

(index="abc" a=”foo”) OR (index="xyz" c=”bar”) 
| bin span=1d _time 
| stats dc(index) as dcount by b,_time 
| where dcount>1 
| stats count as foobar by _time

 

 

 

View solution in original post

0 Karma

Sakshi_Parashar
Engager

Found a working solution for the above problem,

 

 

(index="abc" a=”foo”) OR (index="xyz" c=”bar”) 
| bin span=1d _time 
| stats dc(index) as dcount by b,_time 
| where dcount>1 
| stats count as foobar by _time

 

 

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

There's good talk on this subject at .conf20.  Go to conf.splunk.com to check it out.  In the meantime, try this query

(index="abc" a="foo") OR (index="xyz" c="bar")
| bin span=1h _time
| stats values(*) as * by b
| timechart span="1h" count as foobar
---
If this reply helps you, Karma would be appreciated.
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...