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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...