Splunk Search

stats vs eventstats

zacksoft
Contributor

I can't comprehend what 'eventstats' is. I went thru the splunk docs.
I wanna use math functions like avg.. etc.. not sure whether to use stats avg or eventstats avg !!
An example would be appreciated .

Thank you.

Labels (1)
Tags (1)
1 Solution

mayurr98
Super Champion

hey

stats - Calculates aggregate statistics over the results set, such as average, count, and sum. This is similar to SQL aggregation. If stats is used without a by clause only one row is returned, which is the aggregation over the entire incoming result set. If you use a by clause one row is returned for each distinct value specified in the by clause.
look this doc https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Stats

eventstats - Generate summary statistics of all existing fields in your search results and saves those statistics in to new fields. The eventstats command is similar to the stats command. The difference is that with the eventstats command aggregation results are added inline to each event and added only if the aggregation is pertinent to that event.
look this doc https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Eventstats

And here is a blog which will tell you the extact difference between them
https://www.splunk.com/blog/2014/04/01/search-command-stats-eventstats-and-streamstats-2.html

let me know if this helps !

View solution in original post

mayurr98
Super Champion

hey

stats - Calculates aggregate statistics over the results set, such as average, count, and sum. This is similar to SQL aggregation. If stats is used without a by clause only one row is returned, which is the aggregation over the entire incoming result set. If you use a by clause one row is returned for each distinct value specified in the by clause.
look this doc https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Stats

eventstats - Generate summary statistics of all existing fields in your search results and saves those statistics in to new fields. The eventstats command is similar to the stats command. The difference is that with the eventstats command aggregation results are added inline to each event and added only if the aggregation is pertinent to that event.
look this doc https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Eventstats

And here is a blog which will tell you the extact difference between them
https://www.splunk.com/blog/2014/04/01/search-command-stats-eventstats-and-streamstats-2.html

let me know if this helps !

vinitnitdgp
Engager

correctly said

0 Karma

493669
Super Champion

refer https://answers.splunk.com/answers/139534/what-are-the-calculated-differences-between-stats-and-even...
it will show difference between stats and eventstats with example
Hope this helps you.

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...