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!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...