Splunk Search

cumulative sum

avishni01
Explorer

Hello

I have events that include a field of username ( and of course _time) .I would like to count how many users were added each month, but there are times with no new users were created. 

I can find the first appearance of each user using

Stats min(_time) by username

And then I can use timechart to count new users by month and streamstats to get the cumulative sum.

I have found how to fill the gaps if there were no new users during a month m by using the makecontinues command. what i didn't figure yet is how to fill the period before the first user creation and since the last time a user was created , until today .

... 
| timechart span=1mon count(username) as users
| makecontinues  spam=1mon _time
| fillnull
| streamstats sum(users)  as com

thanks for the help

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Timechart already fills the gaps including before and after based on the time range from the timepicker / earliest and latest, so you should just be able to use streamstats after timechart.

... 
| timechart span=1mon count(username) as users
| streamstats sum(users)  as com
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...