Splunk Search

Group data 'n' rows at a time

nikita012
New Member

I have 40 rows in my data with fields Date, Total. I want to add the values of Total for each 5 days. How can I group data 5 rows at a time?

0 Karma
1 Solution

renjith_nair
Legend

@nikita012,

Try this,

"your current search"
|streamstats count as rowno|eval _fives=if((rowno-1)%5==0,1,0)
|accum _fives as group|eventstats sum(total) by group

you may replace eventstats with stats if you do not want other fields

Happy Splunking!

View solution in original post

renjith_nair
Legend

@nikita012,

Try this,

"your current search"
|streamstats count as rowno|eval _fives=if((rowno-1)%5==0,1,0)
|accum _fives as group|eventstats sum(total) by group

you may replace eventstats with stats if you do not want other fields

Happy Splunking!
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...