Splunk Enterprise

The avg function is unsupported or undefined

R15
Path Finder

I was building a new search and started getting this error with various functions. I simplified my search down to something straight out of the documentation to make sure I wasn't missing something silly, but still get the error even with this: 
index=* | eval c=avg(1, 2, 3)

What's going on?

Labels (1)
0 Karma
1 Solution

R15
Path Finder

@inventsekar apparently avg is not an eval function in my version of splunk. It's available with other things like chart and stats, but not eval. Something like this works however: 
... | chart eval(avg(bytes) ...

View solution in original post

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

as @inventsekar said it should work without issues. Could you try this

| makeresults 
| eval c=avg(1, 2, 3)
| table c

It should give to 2 to you.

When this is working and your current query didn't work, then you have some other issue in it.

You could check which Splunk version you have by click Help -> About on top bar.

r. Ismo

0 Karma

R15
Path Finder

@isoutamo @inventsekar 

We'll be upgrading soon but until then I'm stuck. 

0 Karma

isoutamo
SplunkTrust
SplunkTrust
It seems that avg as an eval function has deployed at 8.1.0 (https://docs.splunk.com/Documentation/Splunk/8.1.0/SearchReference/StatisticalFunctions).
0 Karma

inventsekar
SplunkTrust
SplunkTrust

Hi @R15 .. this search runs fine actually. may we know your remaining portions of the search(after calculating the avg, how do you have handle the avg values?!?!) 
if you provide a screenshot, that would be of great help, thanks. 

 

inventsekar_0-1698712888837.png

 

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma

R15
Path Finder

There is no other portion, running the same search as in your screenshot I get the error.

0 Karma

inventsekar
SplunkTrust
SplunkTrust

@R15 wrote:

There is no other portion, running the same search as in your screenshot I get the error.


Could you pls take a screenshot and attach for our reference, thanks. 

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma

R15
Path Finder

@inventsekar apparently avg is not an eval function in my version of splunk. It's available with other things like chart and stats, but not eval. Something like this works however: 
... | chart eval(avg(bytes) ...

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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