From the course: Splunk Core Certified User (SPLK-1001) Cert Prep

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

stats count function

stats count function

So, let's now start looking at the different functions that are associated with the stats command. We are going to start here with the count function. So we can use the count function to return the number of events for the current search. So you just run a search index equals mean source type equals event chain. You want to see the number of events that are generated by that search. That is a statistic because you want to generate a value. So you just do stats count and And when you just do stats count, then it's going to tell you in this specific case that you have 9,460 events. But then, what field name is it going to give to that result? It just calls that result count and gives it that value. So basically, it associates the number of events to count field by default. Now, can you change that? Yes, there is a way of doing that. So if you wanted to count, and then you give that field a different name, maybe you thought you wanted to call it total events. And then maybe you wanted to…

Contents