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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...