Splunk Search

Calculating Average and Standard Deviation of a Type of Log per Week returns wrong results if searching for all Types

ulloa
Engager

Hi all,

I'm new here, so please let me know if I'm doing anything wrong. Otherwise, the below is my issue. Say for example I have the following type of information logged.

Level=Error
Exception: Type1
***********************************
Level=Error
Exception: Type2
***********************************
Level=Error
Exception: Type3
***********************************
...
***********************************
Level=Error
Exception: Type10

 

I have a splunk search like the following:

index=foo* earliest=-1w latest=@d Level=Error 
Exception="Type2"
| spath Exception 
| rename Exception as Type
| bucket span=1d _time
| stats count by _time, Type
| stats avg(count) as Average by Type
| table Type, Average

This particular search will return the correct calculation for average for the Type.

 

However, upon removing the following line from the search above: 

Exception="Type2"

From my understanding, the search will now open up the calculation of averages for all the types. However, this causes the calculation of the Average to be incorrect in the table.

 

Could you all please help me out to understand why the calculation is inaccurate for the exisiting Type2 as well as the rest after opening up the search for all of the Types?

 

Labels (2)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

One possibility is that your earliest time is not a snap to date, i.e. you are specifying -1w, whereas you might want to use -1w@d as the -1w will be -1w from NOW, so each time you run the search, you are searching a slightly different time range.

 

View solution in original post

0 Karma

bowesmana
SplunkTrust
SplunkTrust

One possibility is that your earliest time is not a snap to date, i.e. you are specifying -1w, whereas you might want to use -1w@d as the -1w will be -1w from NOW, so each time you run the search, you are searching a slightly different time range.

 

0 Karma

ulloa
Engager

That was totally it. It definitely got me the results I wanted. Thanks so much for your help @bowesmana!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...