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!

Database Performance Sidebar Panel Now on APM Database Query Performance & Service ...

We’ve streamlined the troubleshooting experience for database-related service issues by adding a database ...

IM Landing Page Filter - Now Available

We’ve added the capability for you to filter across the summary details on the main Infrastructure Monitoring ...

Dynamic Links from Alerts to IM Navigators - New in Observability Cloud

Splunk continues to improve the troubleshooting experience in Observability Cloud with this latest enhancement ...