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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...