Splunk Search

How to convert now() into strptime?

franciscof
Explorer

Does anyone knows how to do this? Im having a trouble with this convertion.

Thanks in advance

0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

... | eval now = now()
| fieldformat now = strftime(now, "%c")

View solution in original post

0 Karma

woodcock
Esteemed Legend

Like this:

... | eval now = now()
| fieldformat now = strftime(now, "%c")
0 Karma

franciscof
Explorer

Thank you! That worked a treat

0 Karma

to4kawa
Ultra Champion
| convert ctime(now())
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Assuming you want to convert now() into text, you want strftime.

... | eval nowText = strftime(now(), "%Y-%m-%dT%H:%M:%S%Z")
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...

It’s go time — Boston, here we come!

Are you ready to take your Splunk skills to the next level? Get set, because Splunk University is back, and ...

Performance Tuning the Platform, SPL2 Templates, and More New Articles on Splunk ...

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