Splunk Search

Is there a way to change the time duration calculated to a more readable format?

splunkin11
Path Finder

Is there a way to change the time duration calculated to a more readable format?

Trying to go from something like this : "40+09:01:43" to something more like "40 days + 09:01:43"

0 Karma
1 Solution

sundareshr
Legend

This will work even if duration is less than 1 day.

.... | rex field=duration "((?<d>\d+)\+)?(?<t>.*)" | fillnull days value=0 | eval duration=d." days + ".t

View solution in original post

sundareshr
Legend

This will work even if duration is less than 1 day.

.... | rex field=duration "((?<d>\d+)\+)?(?<t>.*)" | fillnull days value=0 | eval duration=d." days + ".t

splunkin11
Path Finder

Excellent! Thank you.

0 Karma

gokadroid
Motivator

if say this data is in field myDate then how about using this below:

query to return myDate
| rex field=myDate "(?<days>[^\+]+)\+(?<myTime>.*)"
| eval completeTime=days." days + ".myTime
| tabe myDate, completeTime

See here the extraction

Get Updates on the Splunk Community!

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...