Splunk Search

Comparing two time frames with the same search?

Orangebottle76
Engager

So I have a search I run for an alert which looks for a missing event, it's a simple tstats that shows stuff within the last 30 days I would like to compare the 90 days variant in the same search and determine the missing events. 

 

Any ideas? 

Labels (3)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

In that case, host field is "eventID"

View solution in original post

0 Karma

yuanliu
SplunkTrust
SplunkTrust

First of all, be careful with the word "event" when talking about Splunk search because if you use tstats, you cannot retrieve what Splunk defines as an "event".  So, I assume that your events carries an identifying field, say "eventID", and that you want to find which eventID's exist in the 90-day search but not in the 30-day search. Is this correct?

For this, you can do something like

| tstats count where earliest=-30d by eventID
| eval thisis = "30day"
| append
    [| tstats count where earliest=-90d by eventID
    | eval thisis = "90day"]
| stats values(thisis) as thisis by eventID
| where mvcount(thisis) == 1 AND thisis == "90day"

Hope this helps.

Tags (2)
0 Karma

Orangebottle76
Engager

Hi,

thanks for the reply! I am doing it for hosts to see which are missing.

0 Karma

yuanliu
SplunkTrust
SplunkTrust

In that case, host field is "eventID"

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...