Splunk Search

How to write regex to extract 2014-09-11/06:00:01.708/EDT

gajananh999
Contributor

Dear All,

I stuck at silly thing i am not able to plot regular expression for 2014-09-11/06:00:01.708/EDT
My Regex is : ^\d{4}-\d{2}-\d{2}/\d{2}:\d{2}:\d{2}.\d{3}

But this is not working can anyone tell me where i an going wrong here.

Thanks

Tags (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

When importing your data, specify the timestamp string in strptime format. This one worked for me using your example:

%Y-%m-%d/%H:%M:%S.%3N/%Z
---
If this reply helps you, Karma would be appreciated.

srioux
Communicator

Per the note above, if you're using Data Preview, should use strptime formatting. Docs:
http://docs.splunk.com/Documentation/Splunk/6.1.3/Data/Modifyeventprocessing#Timestamps

0 Karma

gajananh999
Contributor

Hello MuS,

Its not working for me.
i am trying set Timestamp on Data Preview.

Thanks
Gajanan

0 Karma

MuS
SplunkTrust
SplunkTrust
0 Karma

gajananh999
Contributor

Hello Mus, I have tried without ^ bu no luck. its simple but i dont know where i am going wrong

0 Karma

MuS
SplunkTrust
SplunkTrust

This works on all those online regex testers .... try not to use any ^ or other special signs in the regex.

0 Karma

MuS
SplunkTrust
SplunkTrust

this works up til the timezone, if you need the TZ as well try this:

\d{4}-\d{2}-\d{2}/\d{2}:\d{2}:\d{2}.\d{3}\/\w+

MuS
SplunkTrust
SplunkTrust

or a bit more compact regex like this:

(\d{2,4}[\-\/\:\.])+\w+
0 Karma
Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...