Splunk Search

Join two statistics tables without subsearch

sbarinov
Path Finder

Hi,

 

I am trying to compare event type count statistics for 2 days using the following search:

earliest=-48h latest=-24h | stats count as count1 by eventtype | table eventtype, count1 | join eventtype [search earliest=-24h latest=now() | stats count as count2 by eventtype | table eventtype, count2] | eval diff=(count2-count1)  | table eventtype, diff | sort diff

Is there any option to do this without using subsearch and join?

 

Thanks.

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
earliest=-48h latest=now()
| eval period=floor((now()-_time)/(24*60*60))
| stats count(eval(period=1)) as count1 count(eval(period=0)) as count2 by eventtype
| eval diff=count2-count1
| table eventtype diff
| sort diff

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
earliest=-48h latest=now()
| eval period=floor((now()-_time)/(24*60*60))
| stats count(eval(period=1)) as count1 count(eval(period=0)) as count2 by eventtype
| eval diff=count2-count1
| table eventtype diff
| sort diff

sbarinov
Path Finder

@ITWhisperer  Thank you!

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Updates (ESCU) - New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 3 releases of new content via the Enterprise ...

Thought Leaders are Validating Your Hard Work and Training Rigor

As a Splunk enthusiast and member of the Splunk Community, you are one of thousands who recognize the value of ...

.conf23 Registration is Now Open!

Time to toss the .conf-etti 🎉 —  .conf23 registration is open!   Join us in Las Vegas July 17-20 for ...