Splunk Search

How to edit my current search to find the average?

vtsguerrero
Contributor

Hello guys! Sup?
Can anyone help me to get the average of all current search events and not only the first ones. I have this search below which has everything I need, but just missin' the correct average. How can I achieve the correct average and variation:

index=main sourcetype=main_pc BOTH=* TABLE_VALUE=* PROCESS_NAME=* 
| eval PROCESS=PROCESS_NAME
| eval VOLUME=(BOTH+TABLE_VALUE)  
| streamstats avg(VOLUME) as AVERAGE
| eval VARIATION=((1-(VOLUME/AVERAGE))*100) 
| fieldformat VARIATION=round(VARIATION, 2) 
| table PROCESS_NAMEVOLUMEAVERAGE VARIATION
| rangemap field=VARIATION low=0-20 elevated=20.01-50 severe=40.01-100 default=low

And we get results with different values for each table row, should be the same for this amount of data returned by this current search and time period.

Tags (3)
0 Karma

maciep
Champion

Maybe you want to use eventstats instead of streamstats?

http://blogs.splunk.com/2014/04/01/search-command-stats-eventstats-and-streamstats-2/

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!

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

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 ...