Splunk Search

Field will not convert time

jason_hotchkiss
Communicator

Hello Splunkers,

I have the following field with a date/time stamp:  2021-02-02 15:58:34.0

I am trying to convert it to a format such as: 1612279887.000 
Ultimately it is my goal to use it in a calculation.

I'm using the following search:

search | fields status_dt
| table status_dt
| rename status_dt AS "x"
| eval y=strptime(x, "%m/%d/%y %H:%M:%S") | eval z= strftime(y,"%d %b %Y")
| table x y z

But all I get is a table that looks like:

x                                                        y                    z
2021-02-02 15:58:34.0

What am I doing wrong?  Thanks in advanced

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Your parse string doesn't match the date format you are using

| eval y=strptime(x, "%Y-%m-%d %H:%M:%S")

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your parse string doesn't match the date format you are using

| eval y=strptime(x, "%Y-%m-%d %H:%M:%S")
0 Karma

jason_hotchkiss
Communicator

Thank you very much!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...