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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...