Splunk Search

Convert Decimal to Time Format

nlisle
New Member

Hello, 

I currently have the below search will calculates on average how much time is being spent on the alerts that Splunk generates. On average, it has been calculated that 15 minutes would be spent on each alert for investigation etc. Therefore the below search was written. 

index="_internal" sourcetype="scheduler" thread_id="AlertNotifier*" alert_actions=email savedsearch_name=*
| stats count
| eval count=count/4

Result example: 14 Results x 15 Minutes = 210 Minutes/3 Hours 30 Minutes. My results are showing as '3.5 Hours. '

How could I change this so my final results will be in the format of '3 Hours 30 Minutes'.

Thanks.

N. 

 

Labels (2)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @nlisle,

you can use the tostring function (with the "duration" option) in the eval command, something like this:

| eval count=tostring(count,"duration") 

 Ciao.

Giuseppe

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index="_internal" sourcetype="scheduler" thread_id="AlertNotifier*" alert_actions=email savedsearch_name=*
| stats count
| eval count=count * 15 * 60
| eval count=tostring(count,"duration")
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...