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
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...