Splunk Search

time coversion

infotork
Explorer

Can some one help me to convert  the time format ( hh:mm:ss:nnn) which in string  ( example 0:00:00.041) into seconds, the answer should be for this 0:00:00.041 is 0 seconds.

example : 1. 0:00:00.041 is 0 seconds 
                    2. 0:00:00.500 is 0.5 seconds.

                    

 

Labels (1)
0 Karma
1 Solution

yeahnah
Motivator

Hi @infotork 

Here's one possible example way to do it

| makeresults 
| eval duration=split("00:00:00.500", ".")
      ,micro_secs=(tonumber(mvindex(duration, 1))/1000)
      ,duration=mvindex(duration, 0)   
| convert dur2sec(duration) AS duration_secs
| eval seconds=round((duration_secs + micro_secs), 1)

 

View solution in original post

yeahnah
Motivator

Hi @infotork 

Here's one possible example way to do it

| makeresults 
| eval duration=split("00:00:00.500", ".")
      ,micro_secs=(tonumber(mvindex(duration, 1))/1000)
      ,duration=mvindex(duration, 0)   
| convert dur2sec(duration) AS duration_secs
| eval seconds=round((duration_secs + micro_secs), 1)

 

infotork
Explorer

Thank you so much,

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...