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 | Why did the turkey cross the road?

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

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...