Dashboards & Visualizations

How to extract the timestamp from csv file?

Azwaliyana
Path Finder

Azwaliyana_1-1643262757284.png

 

 It configure the timestamp to be the date when I upload the file. I want the timestamp to be like the highlighted one. How can I do that?

0 Karma

johnhuang
Motivator

Assuming your Splunk timezone is set to the same timezone of the servicenow timestamp:

| rex "\,(?<event_time>\d{2}\/\d{2}\/\d{4}\s\d{2}\:\d{2})\,\d{2}\/"
| eval _time=strptime(event_time,"%m/%d/%Y %H:%M")

 

0 Karma

Azwaliyana
Path Finder

Azwaliyana_1-1643277846216.png

 

 

Why did the 1/12/22 still come out as the result? 

Thank you

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Because you're in US or somewhere similar and use the illogical format m/d/y whereas your responder is used to a normal format and showed you parsing for d/m/y 🙂

Anyway, the "solution" with parsing and overwriting _time at search time works only in search time (obviously) after you've already found the events. So it will not affect your search time ranges.

If you want the events to be indexed at the right time, you need to configure proper timestamp recognition for your sourcetype (define columns extraction and proper time format and time column(s))

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, ...