Splunk Search

Subsearch in realtime search vs scheduled search

chris
Motivator

I have a search that should display a percentage of bad events compared to the good events over a time period. I wanted to migrate this search from a scheduled search to a real time search and for some reason that I can not figure out why the subsearch I use to calculate the total number of events returns a different amount (which varies quite a lot) when I convert it.

Here is the search:

sourcetype=xy source!="good_events" | stats count AS bad_hosts | eval all_hosts = [ search sourcetype="xy" source="good_events" | stats count AS good_hosts | rename good_hosts AS query ] | eval diff = round(bad_hosts/good_hosts*100, 2)

Is it possible that the subsearch is run twice when the realtime search starts and backfills historical events?

Or do you reckon the subsearch isn't necessary for this type of search ... that doesn't answer why switching to real time yields completely different results though.

Thanks

Chris

Tags (2)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi chris,

Sub searches of a real-time search run over all-time unless explicit time bounds are specified within the sub search.
Could that be your problem here?

cheers, MuS

View solution in original post

MuS
SplunkTrust
SplunkTrust

Hi chris,

Sub searches of a real-time search run over all-time unless explicit time bounds are specified within the sub search.
Could that be your problem here?

cheers, MuS

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...