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!

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 ...