Getting Data In

Splunk Time_format and Timestamp prefix option?

poojithavasanth
Explorer

I have the data has "1111|xxx, xxx y|000000|111111|firstname, lastname|10/13/22 02:12:09|"

I used TIME_FORMAT = %m/%d/%Y %H:%M:%S

and Timestamp prefix = ^(?:[^\|\n]*\|){5}

However, I still get an error stating could not use strptime to parse the timestamp.

Would need help in providing timestamp prefix here.

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Firstly, unless you have some strange linebreakers, you don't have to account for \n within the event.

Secondly, if memory serves me right, within a character set you don't escape characters.

So you can try with

TIME_PREFIX = ^([^|]*|){5}

And you need %y instead of %Y (you don't have full year number, just two last digits)

0 Karma

poojithavasanth
Explorer

I see it recognizes the timestamp without adding TIME_PREFIX but with an error "could not use strptime to parse timetsamp".

My goal is to clear the error, which is only possible by adding TIME_PREFIX which suits the situation.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @poojithavasanth,

if you have the above error, Splunk assignes the current timestamp to the event.

Did you tried to use the Add-data function to find the correct timestamp?

I tried using your data and the automatic recognition recognizes your timestamp

gcusello_0-1665728322648.png

Ciao.

Giuseppe

0 Karma

poojithavasanth
Explorer

Thanks for the providing this information. I still do not see it working.

poojithavasanth_0-1665674787763.pngpoojithavasanth_1-1665674809902.png

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @poojithavasanth,

trying with Add data, try to leave the auto detection.

In other words, set the TIME_FORMAT but not the TIME_PREFIX, if you haven't any other date in the log it should recognize the timestamp.

Ciao.

Giuseppe

0 Karma

poojithavasanth
Explorer

File is in .txt format and file content are in psv (pipe-delimited)

Also, Lookahead with 63 did not work too. I believe there should be some updates in TIME_PREFIX.

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @poojithavasanth,

please try this:

TIME_PREFIX = ^([^\|]+\|){5}

Ciao.

Giuseppe

0 Karma

poojithavasanth
Explorer

Yes, it is TIME_PREFIX

poojithavasanth_0-1665663956040.png

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @poojithavasanth,

is your extraction a csv?

did you tried with INDEXED_EXTRACTION = csv?

Anyway, to debug your problem try to manually add a sample of your data using the GUI (Add data) in this way, you can immediately try different options.

Maybe the problem is Lookahead , try with a minor value e,g, 63.

ciao.

Giuseppe

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @poojithavasanth,

I suppose that when you say "Timestamp prefix" you mean TIME_PREFIX, is it correct?

Ciao.

Giuseppe

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!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...