Getting Data In

Extracting event date/time from record with multiple date/times

garryclarke
Path Finder

I have a data input with the following format for which I am struggling to extract the correct data for the SPLUNK event date and time.

MAIN|^0212345678-2|^6.75|^GBP|^2014-12-16|^2014-12-12 12:27:22|^1

The date time field I want to use for the event time is 2014-12-12 12:27:22 however SPLUNK seems to be using a combination of different fields to build the event date and time. For the above record it is deducing an event date and time of 2014-12-16 12:27:22. It seems to be deriving the date from field 5 and the time from field 7. Ultimately I would like the date and time to be derived only from field 7 i.e. 2014-12-12 12:27:22

I have tried various permutations of the following in my props.conf but still remain unsuccessful.

TIME_FORMAT=%Y-%m-%d %H:%M:%S
TIME_PREFIX=(?i)^(?:[^\^]*\^){7}
MAX_TIMESTAMP_LOOKAHEAD=50

Any ideas on what to try next would be much appreciated.

Tags (1)
0 Karma
1 Solution

mzorzi
Splunk Employee
Splunk Employee

This works for me:

[event_sourcetype]
TIME_FORMAT=%Y-%m-%d %H:%M:%S
TIME_PREFIX=^(?:[^\^\n]*\^){5}
MAX_TIMESTAMP_LOOKAHEAD=50

Make sure the event has a sourcetype associated and utilise that sourcetype name in the props.conf

View solution in original post

mzorzi
Splunk Employee
Splunk Employee

This works for me:

[event_sourcetype]
TIME_FORMAT=%Y-%m-%d %H:%M:%S
TIME_PREFIX=^(?:[^\^\n]*\^){5}
MAX_TIMESTAMP_LOOKAHEAD=50

Make sure the event has a sourcetype associated and utilise that sourcetype name in the props.conf

garryclarke
Path Finder

Thanks mzorzi for pointing me in the right direction. I guess I need to spend a bit more time with my regular expressions.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...