Splunk Search

I have an stats result that has a latest(_time) in the config and want to only include items where the latest is N minutes old

leonardr
New Member

index=product_iround_prod Level=INFO Message="Form Synchronizer complete" | stats latest(_time) AS timestamp, latest(RecordsProcessed) AS RecordCount by ProfileName FormName | convert ctime(timestamp) | sort timestamp asc

how do I filter this down to where the latest is older than say 15 minutes ago ?

Tags (1)
0 Karma
1 Solution

gcato
Contributor

Hi leonardr,

Try this

.. | eval mins_back = relative_time(now(), "-15m@m") | where timestamp >= mins_back
|  convert ctime(timestamp)  | sort timestamp asc

Note that timestamp value must still be in epoch time (matching mins_back) for the where to work. Also the where is greater than equal so maybe not exactly what you want. If you want to match a time string exactly then this can get a bit more tricky. Maybe provide some examples if you need more help.

View solution in original post

0 Karma

gcato
Contributor

Hi leonardr,

Try this

.. | eval mins_back = relative_time(now(), "-15m@m") | where timestamp >= mins_back
|  convert ctime(timestamp)  | sort timestamp asc

Note that timestamp value must still be in epoch time (matching mins_back) for the where to work. Also the where is greater than equal so maybe not exactly what you want. If you want to match a time string exactly then this can get a bit more tricky. Maybe provide some examples if you need more help.

0 Karma

leonardr
New Member

Awesome thank you !

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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