Getting Data In

validate default date parsing support for ISO8601

gliptak
Explorer

Is there a way to validate default date parsing against ISO8601 ( 2012-11-02'T'14:34:02,781-07:00 ) date/time? I tried

| makeresults
| eval _raw="2012-11-02'T'14:34:02,781-07:00 foo=bar"

and the timestamp is not being parsed.

I also tried with no success setting

sourcetype=log4j

Any pointers for the syntax to work this?

There are a number of threads without complete approaches around this

https://community.splunk.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false...

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

First, the letter T is not quoted in ISO8601 datetime strings.  The spec may put quotation marks around it, but that's to emphasize it as a literal character.

Second, timestamps are interpreted when the data is indexed.  Since the makeresults command is not indexing any data, no timestamp is parsed.  You need the strptime() function to do that in SPL.

Try putting the sample event into a text file and using the Settings->Add Data wizard to read that file.  Then you'll see the date parsed correctly.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

First, the letter T is not quoted in ISO8601 datetime strings.  The spec may put quotation marks around it, but that's to emphasize it as a literal character.

Second, timestamps are interpreted when the data is indexed.  Since the makeresults command is not indexing any data, no timestamp is parsed.  You need the strptime() function to do that in SPL.

Try putting the sample event into a text file and using the Settings->Add Data wizard to read that file.  Then you'll see the date parsed correctly.

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...