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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...