Splunk Search

Can we convert to tstats?

danielbb
Motivator

Hello,

Is there a way to convert this query to run with tstats? It is _slow_ when running it for two weeks of data...

index=index_name host=IP_name
| eval lag_sec = (_indextime - _time)
| eval lag_min = lag_sec/60
| timechart span=1h avg(lag_min)

 

Labels (1)
Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @danielbb,

if you have so many events that your search is very slow, you could think to schedule your search every night, saving results in a summary index and then run your search on the summary index, something like this:

Scheduled search:

index=index_name host=IP_name earliest=-d@d latest=@d
| eval lag_sec=(_indextime-_time)
| eval lag_min=lag_sec/60
| timechart span=1h avg(lag_min) AS avg_lg_min
| collect index=my_summary

your new search:

index=my_summary
| table orig_time avg_lg_min

At the same time I'd analyze the performaces  of your storage. has it at least 800 IOPS?

Ciao.

Giuseppe

burwell
SplunkTrust
SplunkTrust
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

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

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...