Splunk Search

How to find event timestamp duration with respect to current time in minute and seconds?

Loves-to-Learn Everything

We have splunk event having field "eventdateTime"  in format mentioned below.

for example


2023-04-17 06:45:55,405
2023-04-17 06:45:52,599
2023-04-17 06:45:52,446
2023-04-17 06:45:52,208


We want to create new field "duration" that will give difference of "eventdateTime" value with current date time value in Minute seconds format i.e( duration = 4Min:10.256Sec)

For Example:

 eventdateTime = 22023-04-17 06:51:19,950

current date time = 2023-04-17 06:53:39,000

duration = 2Min:19.050Sec

Labels (1)
Tags (1)
0 Karma

Esteemed Legend

| eval duration=now()-strptime(eventdateTime,"%F %T,%3N")
| fieldformat duration=tostring(duration ,"duration")

0 Karma



| eval duration=tostring(now()-strptime(eventdateTime,"%F %T,%3N"),"duration")


0 Karma
Get Updates on the Splunk Community!

2024 Splunk Career Impact Survey | Earn a $20 gift card for participating!

Hear ye, hear ye! The time has come again for Splunk's annual Career Impact Survey!  We need your help by ...

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...

What's New in Splunk Cloud Platform 9.2.2403?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2403! Analysts can ...