Splunk Search

Splunk replaces zero with null values. Chart Avg(value) omits all those null values, with this avg result is not correct. How to fix this?

dayananda7449
New Member

Hi Everyone, I am a newbie to splunk. We are using splunk to monitor our custom perfmon counters. see the below search query. While performing avg on one of the counters, I am not getting the right result as i expect. I tried with fillnull and so on. Still the same issue. I can fill nulls but i can't those values of zero's in to consideration while calculating average.

index=perfmon collection=ServiceBus counter="Sent/sec" instance="ABC" host ="XYZ" | Timechart avg(Value) 

Result from the above query.

2016-06-27 23:46:00      
2016-06-27 23:47:00     10
2016-06-27 23:48:00     10
2016-06-27 23:49:00      
2016-06-27 23:50:00     10
2016-06-27 23:51:00      
2016-06-27 23:52:00      
2016-06-27 23:53:00     10
2016-06-27 23:54:00      
2016-06-27 23:55:00      
2016-06-27 23:56:00     10
2016-06-27 23:57:00      
2016-06-27 23:58:00      
2016-06-27 23:59:00     10
2016-06-28 00:00:00      
2016-06-28 00:01:00     10

Below is the query that i use to calculate average.

index=perfmon collection=ServiceBus counter="Sent/sec" instance="ABC" host ="XYZ" | chart avg(Value) 

Result from above query is 10 (since i have 7 event where data is non zero, sum all the values and divided by the total events = 70/7 = 10) . This is not the result what i am looking for.

Expected Result is 70/16 = 4.375 . (I have 16 instances of data being reported in the timechart)

Can someone help me out how to fix this issue?

Thanks,
Dayananda

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

index=perfmon collection=ServiceBus counter="Sent/sec" instance="ABC" host ="XYZ" | timechart avg(Value) AS Value | fillnull value="0" Value | chart avg(Value)

View solution in original post

0 Karma

stoutrw
Path Finder

This is also relevant if you don't want to use the fillnull command. There's an option in the visualization tab.

https://answers.splunk.com/answers/474799/how-to-delete-data-points-with-null-values-by-host.html

0 Karma

dayananda7449
New Member

We resolved this issue by adding showZeroValue = 1 in the inputs.config file for each and every category where we need splunk to captured zero value data while forwarding the data to splunk.

0 Karma

woodcock
Esteemed Legend

Like this:

index=perfmon collection=ServiceBus counter="Sent/sec" instance="ABC" host ="XYZ" | timechart avg(Value) AS Value | fillnull value="0" Value | chart avg(Value)
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

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