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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...