Splunk Search

Show the time range of a search in HH:MM in a table

chadman
Path Finder

I would like to show the HH:MM of my search as a field in a table. How can I set that up as a field?

Tags (2)
1 Solution

sundareshr
Legend

Like this

your base search | eval time=strftime(_time, "%H:%M") | table _time time 

*UPDATED based on comment*

your base search | addinfo | eval duration=info_max_time-info_min_time | eval dur_formatted=tostring(duration, "duration") | table dur*

View solution in original post

0 Karma

sundareshr
Legend

Like this

your base search | eval time=strftime(_time, "%H:%M") | table _time time 

*UPDATED based on comment*

your base search | addinfo | eval duration=info_max_time-info_min_time | eval dur_formatted=tostring(duration, "duration") | table dur*
0 Karma

chadman
Path Finder

Perfect! That worked great!

0 Karma

chadman
Path Finder

actually displaying this in seconds would work better.

0 Karma

sundareshr
Legend

So you want to display the duration of the search? Are you displaying it in a dashboard?

0 Karma

chadman
Path Finder

So if I do a search from 8AM to 9AM I would like to see the difference in seconds, 3600

0 Karma

sundareshr
Legend

Aha.. see updated answer below..

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...