Splunk Search

How to display Y axis as HH:MM duration instead of seconds in timechart


I have race data for a regular monthly race, where race time is given as elapsed time in the format MM:SS, e.g. 42:56
I am trying to chart a person's performance each month with

 timechart max(RaceTime) 

However, the Y-axis shows the race time in seconds. I have been trying to get the Y axis in minutes, but it's not clear what's going on.

Splunk tells me that my RaceTime field isnum(RaceTime) is false,
Using | eval RT=tostring(RaceTime, "duration") does not give me any plots on the chart as RT is null because RaceTime is a string already.

I tried this.

| rex field=RaceTime "(?<Minutes>[0-9]*):(?<Seconds>[0-9]*)"
| eval Duration=Minutes*60+Seconds
| eval f=tostring(Duration, "duration")
| timechart max(f)

Using max(Duration) and max(f) show the same chart, i.e. with seconds, although the field f has the event values like 00:42:56.

0 Karma


If you are ok with slightly unconventional gaps between 59th sec and the next full minute u can actually try to do minutes+sec/100 and plot that. That's only if you need max and assuming seconds automatically will never go above 59 in your sample data. Averages might be a pain and will need some tweaking then. But below will work for just the max's and min's.

yourSearch to get fields person, minute and second
| eval newField=minute+second/100
| timechart max(newField) by  person

Let's hope someone gets a better solution of making the y series a modulo 60 to detect min:sec.

0 Karma