Splunk Search

timechart with math function

hartfoml
Motivator

i am using timechart like this

search | timechart span=10m avg(diff)

but the diff number is in seconds I would like the answer in minutes like this

search | timechart span=10m avg(diff)/60

this doesn't work

Anyone have a suggestion??

Tags (2)
0 Karma
1 Solution

BenjaminWyatt
Communicator

Before creating your timechart, use an eval function to format your variable the way you would like. So try something like:

search | eval diff_in_min=(diff/60) | timechart span=10m avg(diff_in_min)

View solution in original post

oaustegard
Engager

A simpler way may be to use eval() (as function):
search | timechart span=10m eval(avg(diff)/60) as diff_in_min

BenjaminWyatt
Communicator

Before creating your timechart, use an eval function to format your variable the way you would like. So try something like:

search | eval diff_in_min=(diff/60) | timechart span=10m avg(diff_in_min)

hartfoml
Motivator

thanks much

0 Karma
Get Updates on the Splunk Community!

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...