Splunk Search

How to add 5 seconds to a time value in strftime format using relative_time command?

C_Sparn
Communicator

Hello
I'm looking for a possibility to add 5 seconds to a time value that is in strftime format.
The crt eval is an example how I use the strftime format. Later it is used for earliest and latest like earliest = crt...

|eval crt = strftime(strptime(CreateTime,"%Y-%m-%d %H:%M:%S"),"%m/%d/%Y:%H:%M:%S")
|eval crt = relative_time(ct,"+5s")

The relative_time command is not working for me.
What am I doing wrong?

Greetings

Tags (2)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

relative_time() works with epoch timestamps, not formatted strings. Apply the five second change after strptime() and before strftime().

View solution in original post

strive
Influencer

martin_mueller
SplunkTrust
SplunkTrust

relative_time() works with epoch timestamps, not formatted strings. Apply the five second change after strptime() and before strftime().

Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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