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 (2)
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
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...