Splunk Search

What is the correct strptime argument?

superisk
Explorer

Hi all,

I am confident with strptime/strftime but i'm really struggling with the correct strptime argument for the following date/time format -

2023-01-25T21:32:04:501+0000

The T between date and time is causing me issues. Thank you in advance!

Labels (1)
0 Karma
1 Solution

rut
Path Finder

Are you getting an error? Adding a "T" in the format is allowed, the following works for me:

| makeresults
| eval example="2023-01-25T21:32:04:501+0000"
| eval parsed_dt=strptime(example, "%Y-%m-%dT%H:%M:%S:%Q%z")
| eval parsed_s=strftime(parsed_dt, "%Y-%m-%dT%H:%M:%S:%Q%z")

View solution in original post

rut
Path Finder

Are you getting an error? Adding a "T" in the format is allowed, the following works for me:

| makeresults
| eval example="2023-01-25T21:32:04:501+0000"
| eval parsed_dt=strptime(example, "%Y-%m-%dT%H:%M:%S:%Q%z")
| eval parsed_s=strftime(parsed_dt, "%Y-%m-%dT%H:%M:%S:%Q%z")

superisk
Explorer

Perfect thank you! It was the %Q i was missing. Much appreciated.

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!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...