Splunk Search

Timewrap to restrict fetch for defined period

vickyvishwa
Explorer

I have a search like below -

mysearch | timechart count span=1h | timewrap 1d

with time range picker for past 7 days. This search fetches all the records for past 7 days with records falling in same Timerange.
But I want to compare the current hour count with last week same day/hour count. And skip timewrap to fetch for remaining 6 days.
In the End of the search I can put a table and fetch only today and 6_days_before columns, but 6 days count fetching is taking lot of time. Rather if we can restrict to fetch only for Present Day and 6 days before, it will be faster.

Any suggestions ?

Tags (1)
0 Karma
1 Solution

DMohn
Motivator

Try the following:

 <your base search> earliest=-7d@d latest=-6d@d | append [search <your base search again> earliest=@d latest=now()] | timechart span=1h count | timewrap 1d

This should leave out all the non-desired days...

View solution in original post

0 Karma

DMohn
Motivator

Try the following:

 <your base search> earliest=-7d@d latest=-6d@d | append [search <your base search again> earliest=@d latest=now()] | timechart span=1h count | timewrap 1d

This should leave out all the non-desired days...

0 Karma

vickyvishwa
Explorer

Thank you. Will this have the restriction of SubSearch ? (50K)

0 Karma

DMohn
Motivator

Yes it will by default, but you may use the command parameters maxout and maxtime for tuning the returned results of the subsearch.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...