Splunk Search

eval streamstats result within timechart can't recognize field

keycoldstorage
Explorer

When I use streamstats to generate last values in the stream I can timechart the results appropriately (without error and with correct results) using timechart avg(last(Comp1))

But, if I want to round the results in the timechart command, the eval fails to locate the field properly: timechart eval(round(avg(last(Comp1)),1)) which results in Error in 'timechart' command: The eval expression has no fields: 'round(avg(last(Comp1)),1)'

What am I doing wrong?

Tags (2)
0 Karma

acdevlin
Communicator

Have you tried something like this?

timechart avg(last(Comp1)) AS myAvg | eval toPrint=round(myAvg,1)

On my end, it added an extra column to the timechart for "toPrint" and had each value rounded to 1 decimal place. However, the "myAvg" column will still be displayed in the chart, and I'm not sure if this is exactly what you're after. If you want to remove the "myAvg" column, you can just add

... | fields toPrint

to the end of the query.

Hope this helps.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...