Splunk Search

latest time values in search query

venky1544
Builder

Hello Everyone,

I have a query where a user selects a time range in the timeticker

Let say 10 november 08:30am to 10 novemeber 11:30am

The user wants to only see the events for the last 5 minutes

 i.e from 10 novmeber 11:25am 10 novemeber 11:30am to look for errors in that 5 minutes

He has two panels

  1. total errors in the the selected timeframe
  2. Total errors in the last 5mins of the selected timeframe

I'm able to create panel 1 how to create panel 2 how

Below search for panel 2

earliest=-5m  latest=$info_max_time$ index=newdata sourcetype=oracle source="/u0/DATA_COUNT.txt" loglevel="ERROR" |bin span=5m _time |stats dc(loglevel) by INSTANCE_NAME

Labels (1)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this for 2

index=newdata sourcetype=oracle source="/u0/DATA_COUNT.txt" loglevel="ERROR"
[| makeresults
| addinfo
| eval earliest=relative_time(info_max_time,"-5m")
| eval latest=info_max_time
| table earliest latest]
| stats dc(loglevel) by INSTANCE_NAME
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...